From c714841cc8f769e000984a0e11c347f4be7826de Mon Sep 17 00:00:00 2001 From: ines Date: Tue, 9 May 2017 00:02:37 +0200 Subject: [PATCH] Move language-specific tests to tests/lang --- spacy/tests/bn/__init__.py | 1 - spacy/tests/fr/__init__.py | 1 - spacy/tests/{ => lang}/bn/test_tokenizer.py | 0 spacy/tests/{ => lang}/de/test_exceptions.py | 0 spacy/tests/{ => lang}/de/test_prefix_suffix_infix.py | 0 spacy/tests/{ => lang}/de/test_text.py | 0 spacy/tests/{ => lang}/en/test_contractions.py | 0 spacy/tests/{ => lang}/en/test_exceptions.py | 0 spacy/tests/{ => lang}/en/test_indices.py | 0 spacy/tests/{ => lang}/en/test_prefix_suffix_infix.py | 0 spacy/tests/{ => lang}/en/test_punct.py | 4 ++-- spacy/tests/{ => lang}/en/test_text.py | 0 spacy/tests/{ => lang}/es/test_exception.py | 0 spacy/tests/{ => lang}/es/test_text.py | 0 spacy/tests/{ => lang}/fi/test_tokenizer.py | 5 ++--- spacy/tests/{ => lang}/fr/test_exceptions.py | 0 spacy/tests/{ => lang}/fr/test_lemmatization.py | 0 spacy/tests/{ => lang}/fr/test_text.py | 2 -- spacy/tests/{ => lang}/he/test_tokenizer.py | 0 spacy/tests/lang/hu/__init__.py | 0 spacy/tests/{ => lang}/hu/test_tokenizer.py | 0 spacy/tests/lang/nb/__init__.py | 0 spacy/tests/{ => lang}/nb/test_tokenizer.py | 0 spacy/tests/lang/sv/__init__.py | 0 spacy/tests/{ => lang}/sv/test_tokenizer.py | 0 25 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 spacy/tests/bn/__init__.py delete mode 100644 spacy/tests/fr/__init__.py rename spacy/tests/{ => lang}/bn/test_tokenizer.py (100%) rename spacy/tests/{ => lang}/de/test_exceptions.py (100%) rename spacy/tests/{ => lang}/de/test_prefix_suffix_infix.py (100%) rename spacy/tests/{ => lang}/de/test_text.py (100%) rename spacy/tests/{ => lang}/en/test_contractions.py (100%) rename spacy/tests/{ => lang}/en/test_exceptions.py (100%) rename spacy/tests/{ => lang}/en/test_indices.py (100%) rename spacy/tests/{ => lang}/en/test_prefix_suffix_infix.py (100%) rename spacy/tests/{ => lang}/en/test_punct.py (97%) rename spacy/tests/{ => lang}/en/test_text.py (100%) rename spacy/tests/{ => lang}/es/test_exception.py (100%) rename spacy/tests/{ => lang}/es/test_text.py (100%) rename spacy/tests/{ => lang}/fi/test_tokenizer.py (84%) rename spacy/tests/{ => lang}/fr/test_exceptions.py (100%) rename spacy/tests/{ => lang}/fr/test_lemmatization.py (100%) rename spacy/tests/{ => lang}/fr/test_text.py (99%) rename spacy/tests/{ => lang}/he/test_tokenizer.py (100%) create mode 100644 spacy/tests/lang/hu/__init__.py rename spacy/tests/{ => lang}/hu/test_tokenizer.py (100%) create mode 100644 spacy/tests/lang/nb/__init__.py rename spacy/tests/{ => lang}/nb/test_tokenizer.py (100%) create mode 100644 spacy/tests/lang/sv/__init__.py rename spacy/tests/{ => lang}/sv/test_tokenizer.py (100%) diff --git a/spacy/tests/bn/__init__.py b/spacy/tests/bn/__init__.py deleted file mode 100644 index 57d631c3f..000000000 --- a/spacy/tests/bn/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# coding: utf-8 diff --git a/spacy/tests/fr/__init__.py b/spacy/tests/fr/__init__.py deleted file mode 100644 index 57d631c3f..000000000 --- a/spacy/tests/fr/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# coding: utf-8 diff --git a/spacy/tests/bn/test_tokenizer.py b/spacy/tests/lang/bn/test_tokenizer.py similarity index 100% rename from spacy/tests/bn/test_tokenizer.py rename to spacy/tests/lang/bn/test_tokenizer.py diff --git a/spacy/tests/de/test_exceptions.py b/spacy/tests/lang/de/test_exceptions.py similarity index 100% rename from spacy/tests/de/test_exceptions.py rename to spacy/tests/lang/de/test_exceptions.py diff --git a/spacy/tests/de/test_prefix_suffix_infix.py b/spacy/tests/lang/de/test_prefix_suffix_infix.py similarity index 100% rename from spacy/tests/de/test_prefix_suffix_infix.py rename to spacy/tests/lang/de/test_prefix_suffix_infix.py diff --git a/spacy/tests/de/test_text.py b/spacy/tests/lang/de/test_text.py similarity index 100% rename from spacy/tests/de/test_text.py rename to spacy/tests/lang/de/test_text.py diff --git a/spacy/tests/en/test_contractions.py b/spacy/tests/lang/en/test_contractions.py similarity index 100% rename from spacy/tests/en/test_contractions.py rename to spacy/tests/lang/en/test_contractions.py diff --git a/spacy/tests/en/test_exceptions.py b/spacy/tests/lang/en/test_exceptions.py similarity index 100% rename from spacy/tests/en/test_exceptions.py rename to spacy/tests/lang/en/test_exceptions.py diff --git a/spacy/tests/en/test_indices.py b/spacy/tests/lang/en/test_indices.py similarity index 100% rename from spacy/tests/en/test_indices.py rename to spacy/tests/lang/en/test_indices.py diff --git a/spacy/tests/en/test_prefix_suffix_infix.py b/spacy/tests/lang/en/test_prefix_suffix_infix.py similarity index 100% rename from spacy/tests/en/test_prefix_suffix_infix.py rename to spacy/tests/lang/en/test_prefix_suffix_infix.py diff --git a/spacy/tests/en/test_punct.py b/spacy/tests/lang/en/test_punct.py similarity index 97% rename from spacy/tests/en/test_punct.py rename to spacy/tests/lang/en/test_punct.py index 06c3350c4..d7d5592f4 100644 --- a/spacy/tests/en/test_punct.py +++ b/spacy/tests/lang/en/test_punct.py @@ -6,8 +6,8 @@ from __future__ import unicode_literals import pytest -from ...util import compile_prefix_regex -from ...language_data import TOKENIZER_PREFIXES +from ....util import compile_prefix_regex +from ....lang.punctuation import TOKENIZER_PREFIXES PUNCT_OPEN = ['(', '[', '{', '*'] diff --git a/spacy/tests/en/test_text.py b/spacy/tests/lang/en/test_text.py similarity index 100% rename from spacy/tests/en/test_text.py rename to spacy/tests/lang/en/test_text.py diff --git a/spacy/tests/es/test_exception.py b/spacy/tests/lang/es/test_exception.py similarity index 100% rename from spacy/tests/es/test_exception.py rename to spacy/tests/lang/es/test_exception.py diff --git a/spacy/tests/es/test_text.py b/spacy/tests/lang/es/test_text.py similarity index 100% rename from spacy/tests/es/test_text.py rename to spacy/tests/lang/es/test_text.py diff --git a/spacy/tests/fi/test_tokenizer.py b/spacy/tests/lang/fi/test_tokenizer.py similarity index 84% rename from spacy/tests/fi/test_tokenizer.py rename to spacy/tests/lang/fi/test_tokenizer.py index 93940a93f..14858b677 100644 --- a/spacy/tests/fi/test_tokenizer.py +++ b/spacy/tests/lang/fi/test_tokenizer.py @@ -3,15 +3,14 @@ from __future__ import unicode_literals import pytest + ABBREVIATION_TESTS = [ ('Hyvää uutta vuotta t. siht. Niemelä!', ['Hyvää', 'uutta', 'vuotta', 't.', 'siht.', 'Niemelä', '!']), ('Paino on n. 2.2 kg', ['Paino', 'on', 'n.', '2.2', 'kg']) ] -TESTCASES = ABBREVIATION_TESTS - -@pytest.mark.parametrize('text,expected_tokens', TESTCASES) +@pytest.mark.parametrize('text,expected_tokens', ABBREVIATION_TESTS) def test_tokenizer_handles_testcases(fi_tokenizer, text, expected_tokens): tokens = fi_tokenizer(text) token_list = [token.text for token in tokens if not token.is_space] diff --git a/spacy/tests/fr/test_exceptions.py b/spacy/tests/lang/fr/test_exceptions.py similarity index 100% rename from spacy/tests/fr/test_exceptions.py rename to spacy/tests/lang/fr/test_exceptions.py diff --git a/spacy/tests/fr/test_lemmatization.py b/spacy/tests/lang/fr/test_lemmatization.py similarity index 100% rename from spacy/tests/fr/test_lemmatization.py rename to spacy/tests/lang/fr/test_lemmatization.py diff --git a/spacy/tests/fr/test_text.py b/spacy/tests/lang/fr/test_text.py similarity index 99% rename from spacy/tests/fr/test_text.py rename to spacy/tests/lang/fr/test_text.py index 35d5a2bd7..94a12e3b6 100644 --- a/spacy/tests/fr/test_text.py +++ b/spacy/tests/lang/fr/test_text.py @@ -1,6 +1,4 @@ # coding: utf8 - - from __future__ import unicode_literals diff --git a/spacy/tests/he/test_tokenizer.py b/spacy/tests/lang/he/test_tokenizer.py similarity index 100% rename from spacy/tests/he/test_tokenizer.py rename to spacy/tests/lang/he/test_tokenizer.py diff --git a/spacy/tests/lang/hu/__init__.py b/spacy/tests/lang/hu/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/spacy/tests/hu/test_tokenizer.py b/spacy/tests/lang/hu/test_tokenizer.py similarity index 100% rename from spacy/tests/hu/test_tokenizer.py rename to spacy/tests/lang/hu/test_tokenizer.py diff --git a/spacy/tests/lang/nb/__init__.py b/spacy/tests/lang/nb/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/spacy/tests/nb/test_tokenizer.py b/spacy/tests/lang/nb/test_tokenizer.py similarity index 100% rename from spacy/tests/nb/test_tokenizer.py rename to spacy/tests/lang/nb/test_tokenizer.py diff --git a/spacy/tests/lang/sv/__init__.py b/spacy/tests/lang/sv/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/spacy/tests/sv/test_tokenizer.py b/spacy/tests/lang/sv/test_tokenizer.py similarity index 100% rename from spacy/tests/sv/test_tokenizer.py rename to spacy/tests/lang/sv/test_tokenizer.py