mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-03 03:40:24 +03:00
Normalize whitespace in evaluate CLI output test
Depending on terminal settings, lines may be padded to the screen width so the comparison is too strict with only the command string replacement.
This commit is contained in:
parent
950fceceb6
commit
f4e98812fe
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typer.testing import CliRunner
|
from typer.testing import CliRunner
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ def test_benchmark_accuracy_alias():
|
||||||
# Verify that the `evaluate` alias works correctly.
|
# Verify that the `evaluate` alias works correctly.
|
||||||
result_benchmark = CliRunner().invoke(app, ["benchmark", "accuracy", "--help"])
|
result_benchmark = CliRunner().invoke(app, ["benchmark", "accuracy", "--help"])
|
||||||
result_evaluate = CliRunner().invoke(app, ["evaluate", "--help"])
|
result_evaluate = CliRunner().invoke(app, ["evaluate", "--help"])
|
||||||
assert result_benchmark.stdout == result_evaluate.stdout.replace(
|
assert re.sub(r"\s+", " ", result_benchmark.stdout) == re.sub(
|
||||||
"spacy evaluate", "spacy benchmark accuracy"
|
r"\s+",
|
||||||
|
" ",
|
||||||
|
result_evaluate.stdout.replace("spacy evaluate", "spacy benchmark accuracy"),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user