mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-04 05:03:06 +03:00
Use a more generic, parametrized test
This commit is contained in:
parent
6d594b966c
commit
9912eff0b5
|
@ -92,7 +92,7 @@ dropout = 0.1
|
||||||
accumulate_gradient = 1
|
accumulate_gradient = 1
|
||||||
patience = 1600
|
patience = 1600
|
||||||
max_epochs = 0
|
max_epochs = 0
|
||||||
max_steps = 20000
|
max_steps = 100
|
||||||
eval_frequency = 200
|
eval_frequency = 200
|
||||||
frozen_components = []
|
frozen_components = []
|
||||||
annotating_components = []
|
annotating_components = []
|
||||||
|
@ -200,44 +200,24 @@ def noop_config():
|
||||||
yield cfg
|
yield cfg
|
||||||
|
|
||||||
|
|
||||||
def test_multi_code_debug_config(code_paths, data_paths, noop_config):
|
@pytest.mark.parametrize(
|
||||||
|
"cmd",
|
||||||
|
[
|
||||||
|
["debug", "config"],
|
||||||
|
["debug", "data"],
|
||||||
|
["train"],
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_multi_code(cmd, code_paths, data_paths, noop_config):
|
||||||
# check that it fails without the code arg
|
# check that it fails without the code arg
|
||||||
result = subprocess.run(
|
cmd = ["python", "-m", "spacy"] + cmd
|
||||||
["python", "-m", "spacy", "debug", "config", str(noop_config), *data_paths]
|
result = subprocess.run([*cmd, str(noop_config), *data_paths])
|
||||||
)
|
|
||||||
assert result.returncode == 1
|
assert result.returncode == 1
|
||||||
|
|
||||||
# check that it succeeds with the code arg
|
# check that it succeeds with the code arg
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[
|
[
|
||||||
"python",
|
*cmd,
|
||||||
"-m",
|
|
||||||
"spacy",
|
|
||||||
"debug",
|
|
||||||
"config",
|
|
||||||
str(noop_config),
|
|
||||||
*data_paths,
|
|
||||||
*code_paths,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
assert result.returncode == 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_multi_code_debug_data(code_paths, data_paths, noop_config):
|
|
||||||
# check that it fails without the code arg
|
|
||||||
result = subprocess.run(
|
|
||||||
["python", "-m", "spacy", "debug", "data", str(noop_config), *data_paths]
|
|
||||||
)
|
|
||||||
assert result.returncode == 1
|
|
||||||
|
|
||||||
# check that it succeeds with the code arg
|
|
||||||
result = subprocess.run(
|
|
||||||
[
|
|
||||||
"python",
|
|
||||||
"-m",
|
|
||||||
"spacy",
|
|
||||||
"debug",
|
|
||||||
"data",
|
|
||||||
str(noop_config),
|
str(noop_config),
|
||||||
*data_paths,
|
*data_paths,
|
||||||
*code_paths,
|
*code_paths,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user