mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
fix config parsing of ints/strings (#7755)
* add few failing tests for parsing integers and strings * bump thinc to 8.0.3
This commit is contained in:
parent
d2bdaa7823
commit
cfad7e21d5
|
@ -5,7 +5,7 @@ requires = [
|
||||||
"cymem>=2.0.2,<2.1.0",
|
"cymem>=2.0.2,<2.1.0",
|
||||||
"preshed>=3.0.2,<3.1.0",
|
"preshed>=3.0.2,<3.1.0",
|
||||||
"murmurhash>=0.28.0,<1.1.0",
|
"murmurhash>=0.28.0,<1.1.0",
|
||||||
"thinc>=8.0.2,<8.1.0",
|
"thinc>=8.0.3,<8.1.0",
|
||||||
"blis>=0.4.0,<0.8.0",
|
"blis>=0.4.0,<0.8.0",
|
||||||
"pathy",
|
"pathy",
|
||||||
"numpy>=1.15.0",
|
"numpy>=1.15.0",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
spacy-legacy>=3.0.3,<3.1.0
|
spacy-legacy>=3.0.3,<3.1.0
|
||||||
cymem>=2.0.2,<2.1.0
|
cymem>=2.0.2,<2.1.0
|
||||||
preshed>=3.0.2,<3.1.0
|
preshed>=3.0.2,<3.1.0
|
||||||
thinc>=8.0.2,<8.1.0
|
thinc>=8.0.3,<8.1.0
|
||||||
blis>=0.4.0,<0.8.0
|
blis>=0.4.0,<0.8.0
|
||||||
ml_datasets>=0.2.0,<0.3.0
|
ml_datasets>=0.2.0,<0.3.0
|
||||||
murmurhash>=0.28.0,<1.1.0
|
murmurhash>=0.28.0,<1.1.0
|
||||||
|
|
|
@ -34,14 +34,14 @@ setup_requires =
|
||||||
cymem>=2.0.2,<2.1.0
|
cymem>=2.0.2,<2.1.0
|
||||||
preshed>=3.0.2,<3.1.0
|
preshed>=3.0.2,<3.1.0
|
||||||
murmurhash>=0.28.0,<1.1.0
|
murmurhash>=0.28.0,<1.1.0
|
||||||
thinc>=8.0.2,<8.1.0
|
thinc>=8.0.3,<8.1.0
|
||||||
install_requires =
|
install_requires =
|
||||||
# Our libraries
|
# Our libraries
|
||||||
spacy-legacy>=3.0.3,<3.1.0
|
spacy-legacy>=3.0.3,<3.1.0
|
||||||
murmurhash>=0.28.0,<1.1.0
|
murmurhash>=0.28.0,<1.1.0
|
||||||
cymem>=2.0.2,<2.1.0
|
cymem>=2.0.2,<2.1.0
|
||||||
preshed>=3.0.2,<3.1.0
|
preshed>=3.0.2,<3.1.0
|
||||||
thinc>=8.0.2,<8.1.0
|
thinc>=8.0.3,<8.1.0
|
||||||
blis>=0.4.0,<0.8.0
|
blis>=0.4.0,<0.8.0
|
||||||
wasabi>=0.8.1,<1.1.0
|
wasabi>=0.8.1,<1.1.0
|
||||||
srsly>=2.4.1,<3.0.0
|
srsly>=2.4.1,<3.0.0
|
||||||
|
|
|
@ -307,8 +307,11 @@ def test_project_config_validation2(config, n_errors):
|
||||||
assert len(errors) == n_errors
|
assert len(errors) == n_errors
|
||||||
|
|
||||||
|
|
||||||
def test_project_config_interpolation():
|
@pytest.mark.parametrize(
|
||||||
variables = {"a": 10, "b": {"c": "foo", "d": True}}
|
"int_value", [10, pytest.param("10", marks=pytest.mark.xfail)],
|
||||||
|
)
|
||||||
|
def test_project_config_interpolation(int_value):
|
||||||
|
variables = {"a": int_value, "b": {"c": "foo", "d": True}}
|
||||||
commands = [
|
commands = [
|
||||||
{"name": "x", "script": ["hello ${vars.a} ${vars.b.c}"]},
|
{"name": "x", "script": ["hello ${vars.a} ${vars.b.c}"]},
|
||||||
{"name": "y", "script": ["${vars.b.c} ${vars.b.d}"]},
|
{"name": "y", "script": ["${vars.b.c} ${vars.b.d}"]},
|
||||||
|
@ -317,6 +320,8 @@ def test_project_config_interpolation():
|
||||||
with make_tempdir() as d:
|
with make_tempdir() as d:
|
||||||
srsly.write_yaml(d / "project.yml", project)
|
srsly.write_yaml(d / "project.yml", project)
|
||||||
cfg = load_project_config(d)
|
cfg = load_project_config(d)
|
||||||
|
assert type(cfg) == dict
|
||||||
|
assert type(cfg["commands"]) == list
|
||||||
assert cfg["commands"][0]["script"][0] == "hello 10 foo"
|
assert cfg["commands"][0]["script"][0] == "hello 10 foo"
|
||||||
assert cfg["commands"][1]["script"][0] == "foo true"
|
assert cfg["commands"][1]["script"][0] == "foo true"
|
||||||
commands = [{"name": "x", "script": ["hello ${vars.a} ${vars.b.e}"]}]
|
commands = [{"name": "x", "script": ["hello ${vars.a} ${vars.b.e}"]}]
|
||||||
|
@ -325,6 +330,24 @@ def test_project_config_interpolation():
|
||||||
substitute_project_variables(project)
|
substitute_project_variables(project)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"greeting", [342, "everyone", "tout le monde", pytest.param("42", marks=pytest.mark.xfail)],
|
||||||
|
)
|
||||||
|
def test_project_config_interpolation_override(greeting):
|
||||||
|
variables = {"a": "world"}
|
||||||
|
commands = [
|
||||||
|
{"name": "x", "script": ["hello ${vars.a}"]},
|
||||||
|
]
|
||||||
|
overrides = {"vars.a": greeting}
|
||||||
|
project = {"commands": commands, "vars": variables}
|
||||||
|
with make_tempdir() as d:
|
||||||
|
srsly.write_yaml(d / "project.yml", project)
|
||||||
|
cfg = load_project_config(d, overrides=overrides)
|
||||||
|
assert type(cfg) == dict
|
||||||
|
assert type(cfg["commands"]) == list
|
||||||
|
assert cfg["commands"][0]["script"][0] == f"hello {greeting}"
|
||||||
|
|
||||||
|
|
||||||
def test_project_config_interpolation_env():
|
def test_project_config_interpolation_env():
|
||||||
variables = {"a": 10}
|
variables = {"a": 10}
|
||||||
env_var = "SPACY_TEST_FOO"
|
env_var = "SPACY_TEST_FOO"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user