mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 01:04:34 +03:00
Remove flaky assertions. (#12210)
This commit is contained in:
parent
0e51c918ae
commit
02af17a5c8
|
@ -1017,8 +1017,6 @@ def test_local_remote_storage_pull_missing():
|
||||||
|
|
||||||
|
|
||||||
def test_cli_find_threshold(capsys):
|
def test_cli_find_threshold(capsys):
|
||||||
thresholds = numpy.linspace(0, 1, 10)
|
|
||||||
|
|
||||||
def make_examples(nlp: Language) -> List[Example]:
|
def make_examples(nlp: Language) -> List[Example]:
|
||||||
docs: List[Example] = []
|
docs: List[Example] = []
|
||||||
|
|
||||||
|
@ -1082,8 +1080,6 @@ def test_cli_find_threshold(capsys):
|
||||||
scores_key="cats_macro_f",
|
scores_key="cats_macro_f",
|
||||||
silent=True,
|
silent=True,
|
||||||
)
|
)
|
||||||
assert best_threshold != thresholds[0]
|
|
||||||
assert thresholds[0] < best_threshold < thresholds[9]
|
|
||||||
assert best_score == max(res.values())
|
assert best_score == max(res.values())
|
||||||
assert res[1.0] == 0.0
|
assert res[1.0] == 0.0
|
||||||
|
|
||||||
|
@ -1091,7 +1087,7 @@ def test_cli_find_threshold(capsys):
|
||||||
nlp, _ = init_nlp((("spancat", {}),))
|
nlp, _ = init_nlp((("spancat", {}),))
|
||||||
with make_tempdir() as nlp_dir:
|
with make_tempdir() as nlp_dir:
|
||||||
nlp.to_disk(nlp_dir)
|
nlp.to_disk(nlp_dir)
|
||||||
res = find_threshold(
|
best_threshold, best_score, res = find_threshold(
|
||||||
model=nlp_dir,
|
model=nlp_dir,
|
||||||
data_path=docs_dir / "docs.spacy",
|
data_path=docs_dir / "docs.spacy",
|
||||||
pipe_name="spancat",
|
pipe_name="spancat",
|
||||||
|
@ -1099,10 +1095,8 @@ def test_cli_find_threshold(capsys):
|
||||||
scores_key="spans_sc_f",
|
scores_key="spans_sc_f",
|
||||||
silent=True,
|
silent=True,
|
||||||
)
|
)
|
||||||
assert res[0] != thresholds[0]
|
assert best_score == max(res.values())
|
||||||
assert thresholds[0] < res[0] < thresholds[8]
|
assert res[1.0] == 0.0
|
||||||
assert res[1] >= 0.6
|
|
||||||
assert res[2][1.0] == 0.0
|
|
||||||
|
|
||||||
# Having multiple textcat_multilabel components should work, since the name has to be specified.
|
# Having multiple textcat_multilabel components should work, since the name has to be specified.
|
||||||
nlp, _ = init_nlp((("textcat_multilabel", {}),))
|
nlp, _ = init_nlp((("textcat_multilabel", {}),))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user