mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-14 18:22:27 +03:00
Fix URL tests
This commit is contained in:
parent
9936a1b9b5
commit
3ba7c167a8
|
@ -16,12 +16,12 @@ URLS = [
|
||||||
|
|
||||||
# Punctuation we want to check is split away before the URL
|
# Punctuation we want to check is split away before the URL
|
||||||
PREFIXES = [
|
PREFIXES = [
|
||||||
"(", '"', "...", ":", "<", ">", ")"
|
"(", '"', "...", ">"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Punctuation we want to check is split away after the URL
|
# Punctuation we want to check is split away after the URL
|
||||||
SUFFIXES = [
|
SUFFIXES = [
|
||||||
"(", '"', "...", ":", "<", ">"]
|
'"', ":", ">"]
|
||||||
|
|
||||||
@pytest.mark.parametrize("text", URLS)
|
@pytest.mark.parametrize("text", URLS)
|
||||||
def test_simple_url(en_tokenizer, text):
|
def test_simple_url(en_tokenizer, text):
|
||||||
|
@ -40,10 +40,10 @@ def test_prefixed_url(en_tokenizer, prefix, url):
|
||||||
|
|
||||||
@pytest.mark.parametrize("suffix", SUFFIXES)
|
@pytest.mark.parametrize("suffix", SUFFIXES)
|
||||||
@pytest.mark.parametrize("url", URLS)
|
@pytest.mark.parametrize("url", URLS)
|
||||||
def test_prefixed_url(en_tokenizer, suffix, url):
|
def test_suffixed_url(en_tokenizer, url, suffix):
|
||||||
tokens = en_tokenizer(url + suffix)
|
tokens = en_tokenizer(url + suffix)
|
||||||
assert tokens[1].text == suffix
|
|
||||||
assert tokens[0].text == url
|
assert tokens[0].text == url
|
||||||
|
assert tokens[1].text == suffix
|
||||||
assert len(tokens) == 2
|
assert len(tokens) == 2
|
||||||
|
|
||||||
@pytest.mark.parametrize("prefix", PREFIXES)
|
@pytest.mark.parametrize("prefix", PREFIXES)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user