mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-29 13:23:40 +03:00
Merge branch 'master' of https://github.com/explosion/spaCy
This commit is contained in:
commit
df2ac8b843
|
@ -23,6 +23,8 @@ is_windows = sys.platform.startswith('win')
|
||||||
is_linux = sys.platform.startswith('linux')
|
is_linux = sys.platform.startswith('linux')
|
||||||
is_osx = sys.platform == 'darwin'
|
is_osx = sys.platform == 'darwin'
|
||||||
|
|
||||||
|
fix_text = ftfy.fix_text
|
||||||
|
|
||||||
|
|
||||||
if is_python2:
|
if is_python2:
|
||||||
bytes_ = str
|
bytes_ = str
|
||||||
|
@ -39,9 +41,6 @@ elif is_python3:
|
||||||
json_dumps = lambda data: ujson.dumps(data, indent=2)
|
json_dumps = lambda data: ujson.dumps(data, indent=2)
|
||||||
|
|
||||||
|
|
||||||
fix_text = lambda text: ftfy.fix_text(text)
|
|
||||||
|
|
||||||
|
|
||||||
def symlink_to(orig, dest):
|
def symlink_to(orig, dest):
|
||||||
if is_python2 and is_windows:
|
if is_python2 and is_windows:
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -2,17 +2,18 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from ..cli.download import download, get_compatibility, get_version, check_error_depr
|
from ..cli.download import download, get_compatibility, get_version, check_error_depr
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('model', ['en_core_web_md'])
|
@pytest.mark.parametrize('model', ['en_core_web_md'])
|
||||||
def test_download_get_matching_version_succeeds(model):
|
def test_cli_download_get_matching_version_succeeds(model):
|
||||||
comp = { model: ['1.7.0', '0.100.0'] }
|
comp = { model: ['1.7.0', '0.100.0'] }
|
||||||
assert get_version(model, comp)
|
assert get_version(model, comp)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('model', ['en_core_web_md'])
|
@pytest.mark.parametrize('model', ['en_core_web_md'])
|
||||||
def test_download_get_matching_version_fails(model):
|
def test_cli_download_get_matching_version_fails(model):
|
||||||
diff_model = 'test_' + model
|
diff_model = 'test_' + model
|
||||||
comp = { diff_model: ['1.7.0', '0.100.0'] }
|
comp = { diff_model: ['1.7.0', '0.100.0'] }
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
|
@ -20,6 +21,6 @@ def test_download_get_matching_version_fails(model):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('model', [False, None, '', 'all'])
|
@pytest.mark.parametrize('model', [False, None, '', 'all'])
|
||||||
def test_download_no_model_depr_error(model):
|
def test_cli_download_no_model_depr_error(model):
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
check_error_depr(model)
|
check_error_depr(model)
|
13
spacy/tests/test_misc.py
Normal file
13
spacy/tests/test_misc.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from ..util import ensure_path
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('text', ['hello/world', 'hello world'])
|
||||||
|
def test_util_ensure_path_succeeds(text):
|
||||||
|
path = ensure_path(text)
|
||||||
|
assert isinstance(path, Path)
|
Loading…
Reference in New Issue
Block a user