test_compound_strategy.py 712 B

123456789101112131415161718192021222324252627
  1. import json
  2. import pytest
  3. import spacy
  4. from word_processor.generators import Generator
  5. from word_processor.strategies import compound_strategy
  6. nlp = spacy.load("en_core_web_trf")
  7. @pytest.mark.parametrize('text', [
  8. 'Regex for redacted phone numbers with extra info for PlayStation',
  9. 'Stick element after scroll has passed the element',
  10. 'Stick element after scroll has passed the element',
  11. ])
  12. def test_compound_strategy(snapshot, text):
  13. generator = Generator(text=text, strategy=compound_strategy)
  14. results = generator.suggest()
  15. text_results = []
  16. for suggestion in results:
  17. text_results.append([token.lemma_ for token in suggestion])
  18. assert text_results == snapshot