spaCy/spacy/tests/test_cli.py

27 lines
803 B
Python
Raw Normal View History

2017-03-15 19:39:43 +03:00
# coding: utf-8
from __future__ import unicode_literals
from ..cli.download import download, get_compatibility, get_version, check_error_depr
2017-04-23 22:06:36 +03:00
2017-03-15 19:39:43 +03:00
import pytest
@pytest.mark.parametrize('model', ['en_core_web_md'])
2017-04-23 22:06:36 +03:00
def test_cli_download_get_matching_version_succeeds(model):
2017-03-15 19:39:43 +03:00
comp = { model: ['1.7.0', '0.100.0'] }
assert get_version(model, comp)
@pytest.mark.parametrize('model', ['en_core_web_md'])
2017-04-23 22:06:36 +03:00
def test_cli_download_get_matching_version_fails(model):
2017-03-15 19:39:43 +03:00
diff_model = 'test_' + model
comp = { diff_model: ['1.7.0', '0.100.0'] }
with pytest.raises(SystemExit):
assert get_version(model, comp)
@pytest.mark.parametrize('model', [False, None, '', 'all'])
2017-04-23 22:06:36 +03:00
def test_cli_download_no_model_depr_error(model):
2017-03-15 19:39:43 +03:00
with pytest.raises(SystemExit):
check_error_depr(model)