mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 03:10:22 +03:00
Change to normalization method
This commit is contained in:
parent
431465befc
commit
8c3df5f372
|
@ -3,7 +3,7 @@ from pathlib import Path
|
|||
from typer.testing import CliRunner
|
||||
|
||||
from spacy.cli._util import app
|
||||
from .util import make_tempdir, assert_strings_equal_except_ws
|
||||
from .util import make_tempdir, normalize_whitespace
|
||||
|
||||
|
||||
def test_convert_auto():
|
||||
|
@ -37,7 +37,6 @@ def test_benchmark_accuracy_alias():
|
|||
# Verify that the `evaluate` alias works correctly.
|
||||
result_benchmark = CliRunner().invoke(app, ["benchmark", "accuracy", "--help"])
|
||||
result_evaluate = CliRunner().invoke(app, ["evaluate", "--help"])
|
||||
assert_strings_equal_except_ws(
|
||||
result_benchmark.stdout,
|
||||
result_evaluate.stdout.replace("spacy evaluate", "spacy benchmark accuracy"),
|
||||
assert normalize_whitespace(result_benchmark.stdout) == normalize_whitespace(
|
||||
result_evaluate.stdout.replace("spacy evaluate", "spacy benchmark accuracy")
|
||||
)
|
||||
|
|
|
@ -98,6 +98,5 @@ def assert_packed_msg_equal(b1, b2):
|
|||
assert v1 == v2
|
||||
|
||||
|
||||
def assert_strings_equal_except_ws(s1, s2):
|
||||
"""Assert that two strings are identical except for whitespace."""
|
||||
assert re.sub(r"\s+", " ", s1) == re.sub(r"\s+", " ", s2)
|
||||
def normalize_whitespace(s):
|
||||
return re.sub(r"\s+", " ", s)
|
||||
|
|
Loading…
Reference in New Issue
Block a user