Kaynağa Gözat

update pytest snapshot with syrupy lib

Nikos Atlas 2 yıl önce
ebeveyn
işleme
4c39600819
25 değiştirilmiş dosya ile 189 ekleme ve 22 silme
  1. 51 2
      requirements.txt
  2. 1 1
      word_processor/parsers/javascript.py
  3. 20 0
      word_processor/tests/__snapshots__/test_antonyms.ambr
  4. 8 0
      word_processor/tests/__snapshots__/test_javascript_parser.ambr
  5. 62 0
      word_processor/tests/__snapshots__/test_leaf_strategy.ambr
  6. 16 0
      word_processor/tests/__snapshots__/test_parser.ambr
  7. 24 0
      word_processor/tests/__snapshots__/test_synonyms.ambr
  8. 0 1
      word_processor/tests/snapshots/test_antonyms/test_antonyms/cat/antonyms
  9. 0 1
      word_processor/tests/snapshots/test_antonyms/test_antonyms/dog/antonyms
  10. 0 1
      word_processor/tests/snapshots/test_antonyms/test_antonyms/factory/antonyms
  11. 0 1
      word_processor/tests/snapshots/test_antonyms/test_antonyms/fetcher/antonyms
  12. 0 1
      word_processor/tests/snapshots/test_antonyms/test_antonyms/serializer/antonyms
  13. 0 1
      word_processor/tests/snapshots/test_javascript_parser/test_parser/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation/javascript_parser
  14. 0 1
      word_processor/tests/snapshots/test_leaf_strategy/test_leaf_strategy/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation-expected0/leaf_strategy
  15. 0 1
      word_processor/tests/snapshots/test_parser/test_parser/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation/parser
  16. 0 1
      word_processor/tests/snapshots/test_synonyms/test_synonyms/cat/synonyms
  17. 0 1
      word_processor/tests/snapshots/test_synonyms/test_synonyms/dog/synonyms
  18. 0 1
      word_processor/tests/snapshots/test_synonyms/test_synonyms/factory/synonyms
  19. 0 1
      word_processor/tests/snapshots/test_synonyms/test_synonyms/fetcher/synonyms
  20. 0 1
      word_processor/tests/snapshots/test_synonyms/test_synonyms/serializer/synonyms
  21. 1 1
      word_processor/tests/test_antonyms.py
  22. 2 2
      word_processor/tests/test_javascript_parser.py
  23. 1 1
      word_processor/tests/test_leaf_strategy.py
  24. 2 1
      word_processor/tests/test_parser.py
  25. 1 1
      word_processor/tests/test_synonyms.py

+ 51 - 2
requirements.txt

@@ -1,5 +1,54 @@
+attrs==21.4.0
+blis==0.7.5
+catalogue==2.0.6
+certifi==2021.10.8
+charset-normalizer==2.0.10
+click==8.0.3
+colored==1.4.3
+cymem==2.0.6
+docopt==0.6.2
+en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.2.0/en_core_web_trf-3.2.0-py3-none-any.whl
+filelock==3.4.2
+huggingface-hub==0.4.0
+idna==3.3
+iniconfig==1.1.1
+Jinja2==3.0.3
+joblib==1.1.0
+langcodes==3.3.0
+MarkupSafe==2.0.1
+murmurhash==1.0.6
+nltk==3.6.7
+numpy==1.22.1
+packaging==21.3
+pathy==0.6.1
+pipreqs==0.4.11
+pluggy==1.0.0
+preshed==3.0.6
 py==1.11.0
+pydantic==1.8.2
+pyparsing==3.0.7
 pytest==6.2.5
-setuptools==60.5.0
+PyYAML==6.0
+regex==2022.1.18
+requests==2.27.1
+sacremoses==0.0.47
+six==1.16.0
+smart-open==5.2.1
 spacy==3.2.1
-nltk~=3.6.7
+spacy-alignments==0.8.4
+spacy-legacy==3.0.8
+spacy-loggers==1.0.1
+spacy-transformers==1.1.4
+srsly==2.4.2
+syrupy==1.7.0
+thinc==8.0.13
+tokenizers==0.10.3
+toml==0.10.2
+torch==1.10.1
+tqdm==4.62.3
+transformers==4.15.0
+typer==0.4.0
+typing_extensions==4.0.1
+urllib3==1.26.8
+wasabi==0.9.0
+yarg==0.1.9

+ 1 - 1
word_processor/parsers/javascript.py

@@ -13,4 +13,4 @@ class JavascriptParser(Parser):
         parsed_words = super().parse_words(words)
         parsed_words.reverse()
 
-        return parsed_words
+        return parsed_words

+ 20 - 0
word_processor/tests/__snapshots__/test_antonyms.ambr

@@ -0,0 +1,20 @@
+# name: test_antonyms[cat]
+  <class 'list'> [
+  ]
+---
+# name: test_antonyms[dog]
+  <class 'list'> [
+  ]
+---
+# name: test_antonyms[factory]
+  <class 'list'> [
+  ]
+---
+# name: test_antonyms[fetcher]
+  <class 'list'> [
+  ]
+---
+# name: test_antonyms[serializer]
+  <class 'list'> [
+  ]
+---

+ 8 - 0
word_processor/tests/__snapshots__/test_javascript_parser.ambr

@@ -0,0 +1,8 @@
+# name: test_javascript_parser[Regex for redacted phone numbers with extra info for PlayStation]
+  <class 'list'> [
+    'RedactedNumbersForRegex',
+    'PhoneNumbersForRegex',
+    'ExtraInfoWithNumbersForRegex',
+    'PlaystationForInfoWithNumbersForRegex',
+  ]
+---

+ 62 - 0
word_processor/tests/__snapshots__/test_leaf_strategy.ambr

@@ -0,0 +1,62 @@
+# name: test_leaf_strategy[Regex for redacted phone numbers with extra info for PlayStation-expected0]
+  <class 'list'> [
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'redacted',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'phone',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'with',
+      'info',
+      'extra',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'with',
+      'info',
+      'for',
+      'PlayStation',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'redacted',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'phone',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'with',
+      'info',
+      'extra',
+    ],
+    <class 'list'> [
+      'Regex',
+      'for',
+      'numbers',
+      'with',
+      'info',
+      'for',
+      'PlayStation',
+    ],
+  ]
+---

+ 16 - 0
word_processor/tests/__snapshots__/test_parser.ambr

@@ -0,0 +1,16 @@
+# name: test_parser[Regex for redacted phone numbers with extra info for PlayStation]
+  <class 'list'> [
+    'Regexfornumbersredacted',
+    'Regexfornumbersphone',
+    'Regexfornumberswithinfoextra',
+    'RegexfornumberswithinfoforPlayStation',
+    'Regexfornumbersredacted',
+    'Regexfornumbersphone',
+    'Regexfornumberswithinfoextra',
+    'RegexfornumberswithinfoforPlayStation',
+    'Regexfornumbersredacted',
+    'Regexfornumbersphone',
+    'Regexfornumberswithinfoextra',
+    'RegexfornumberswithinfoforPlayStation',
+  ]
+---

+ 24 - 0
word_processor/tests/__snapshots__/test_synonyms.ambr

@@ -0,0 +1,24 @@
+# name: test_synonyms[cat]
+  <class 'list'> [
+  ]
+---
+# name: test_synonyms[dog]
+  <class 'list'> [
+  ]
+---
+# name: test_synonyms[factory]
+  <class 'list'> [
+    'factory',
+    'mill',
+    'manufacturing_plant',
+    'manufactory',
+  ]
+---
+# name: test_synonyms[fetcher]
+  <class 'list'> [
+  ]
+---
+# name: test_synonyms[serializer]
+  <class 'list'> [
+  ]
+---

+ 0 - 1
word_processor/tests/snapshots/test_antonyms/test_antonyms/cat/antonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_antonyms/test_antonyms/dog/antonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_antonyms/test_antonyms/factory/antonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_antonyms/test_antonyms/fetcher/antonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_antonyms/test_antonyms/serializer/antonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_javascript_parser/test_parser/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation/javascript_parser

@@ -1 +0,0 @@
-["RedactedNumbersForRegex", "PhoneNumbersForRegex", "ExtraInfoWithNumbersForRegex", "PlaystationForInfoWithNumbersForRegex"]

+ 0 - 1
word_processor/tests/snapshots/test_leaf_strategy/test_leaf_strategy/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation-expected0/leaf_strategy

@@ -1 +0,0 @@
-[["Regex", "for", "numbers", "redacted"], ["Regex", "for", "numbers", "phone"], ["Regex", "for", "numbers", "with", "info", "extra"], ["Regex", "for", "numbers", "with", "info", "for", "PlayStation"], ["Regex", "for", "numbers", "redacted"], ["Regex", "for", "numbers", "phone"], ["Regex", "for", "numbers", "with", "info", "extra"], ["Regex", "for", "numbers", "with", "info", "for", "PlayStation"]]

+ 0 - 1
word_processor/tests/snapshots/test_parser/test_parser/Regex_for_redacted_phone_numbers_with_extra_info_for_PlayStation/parser

@@ -1 +0,0 @@
-["Regexfornumbersredacted", "Regexfornumbersphone", "Regexfornumberswithinfoextra", "RegexfornumberswithinfoforPlayStation", "Regexfornumbersredacted", "Regexfornumbersphone", "Regexfornumberswithinfoextra", "RegexfornumberswithinfoforPlayStation", "Regexfornumbersredacted", "Regexfornumbersphone", "Regexfornumberswithinfoextra", "RegexfornumberswithinfoforPlayStation"]

+ 0 - 1
word_processor/tests/snapshots/test_synonyms/test_synonyms/cat/synonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_synonyms/test_synonyms/dog/synonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_synonyms/test_synonyms/factory/synonyms

@@ -1 +0,0 @@
-["factory", "mill", "manufacturing_plant", "manufactory"]

+ 0 - 1
word_processor/tests/snapshots/test_synonyms/test_synonyms/fetcher/synonyms

@@ -1 +0,0 @@
-[]

+ 0 - 1
word_processor/tests/snapshots/test_synonyms/test_synonyms/serializer/synonyms

@@ -1 +0,0 @@
-[]

+ 1 - 1
word_processor/tests/test_antonyms.py

@@ -18,4 +18,4 @@ import word_processor.generators.synonym as synonym
 def test_antonyms(snapshot, word):
     result = synonym.get_antonyms(word)
 
-    snapshot.assert_match(json.dumps(result), 'antonyms')
+    assert result == snapshot

+ 2 - 2
word_processor/tests/test_javascript_parser.py

@@ -9,11 +9,11 @@ from word_processor.strategies import leaf_strategy
 @pytest.mark.parametrize('text', [
     'Regex for redacted phone numbers with extra info for PlayStation'
 ])
-def test_parser(snapshot, text):
+def test_javascript_parser(snapshot, text):
     generator = Generator(text=text, strategy=leaf_strategy, parser=JavascriptParser())
 
     generator.suggest()
 
     presentation = generator.present()
-    snapshot.assert_match(json.dumps(presentation), 'javascript_parser')
 
+    assert presentation == snapshot

+ 1 - 1
word_processor/tests/test_leaf_strategy.py

@@ -23,4 +23,4 @@ def test_leaf_strategy(snapshot, text, expected):
     for suggestion in results:
         text_results.append([token.text for token in suggestion])
 
-    snapshot.assert_match(json.dumps(text_results), 'leaf_strategy')
+    assert text_results == snapshot

+ 2 - 1
word_processor/tests/test_parser.py

@@ -15,5 +15,6 @@ def test_parser(snapshot, text):
     generator.suggest()
 
     presentation = generator.present()
-    snapshot.assert_match(json.dumps(presentation), 'parser')
+
+    assert presentation == snapshot
 

+ 1 - 1
word_processor/tests/test_synonyms.py

@@ -18,4 +18,4 @@ import word_processor.generators.synonym as synonym
 def test_synonyms(snapshot, word):
     result = synonym.get_synonyms(word)
 
-    snapshot.assert_match(json.dumps(result), 'synonyms')
+    assert result == snapshot