Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
fix test_corpus_init on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
internaut committed Mar 11, 2022
1 parent b3c0989 commit 954ff80
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tests/test_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,6 @@ def test_corpus_init():
_check_copies(corp, copy(corp), same_nlp_instance=True)
_check_copies(corp, deepcopy(corp), same_nlp_instance=False)

if 'en_core_web_md' in spacy.util.get_installed_models():
corp = c.Corpus(textdata_en, language='en', load_features={'vectors', 'tok2vec', 'tagger', 'morphologizer',
'parser', 'attribute_ruler', 'lemmatizer', 'ner'})
assert corp.has_sents
assert corp.language_model == 'en_core_web_md'
_check_corpus_docs(corp, has_sents=True)
assert 'ner' in corp.nlp.pipe_names

_check_copies(corp, copy(corp), same_nlp_instance=True)
_check_copies(corp, deepcopy(corp), same_nlp_instance=False)
else:
raise RuntimeWarning('language model "en_core_web_md" not installed')

corp = c.Corpus(textdata_en, language='en', load_features={'tok2vec', 'senter'})
assert corp.has_sents
assert corp.language_model == 'en_core_web_sm'
Expand Down Expand Up @@ -261,6 +248,20 @@ def test_corpus_init():
_check_copies(corp, deepcopy(corp), same_nlp_instance=False)


@pytest.mark.skipif('en_core_web_md' not in spacy.util.get_installed_models(),
reason='language model "en_core_web_md" not installed')
def test_corpus_init_md_model_required():
corp = c.Corpus(textdata_en, language='en', load_features={'vectors', 'tok2vec', 'tagger', 'morphologizer',
'parser', 'attribute_ruler', 'lemmatizer', 'ner'})
assert corp.has_sents
assert corp.language_model == 'en_core_web_md'
_check_corpus_docs(corp, has_sents=True)
assert 'ner' in corp.nlp.pipe_names

_check_copies(corp, copy(corp), same_nlp_instance=True)
_check_copies(corp, deepcopy(corp), same_nlp_instance=False)


@settings(deadline=None)
@given(docs=strategy_str_str_dict_printable(),
punctuation=st.one_of(st.none(), st.lists(st.text(string.punctuation, min_size=1, max_size=1))),
Expand Down

0 comments on commit 954ff80

Please sign in to comment.