def test_analyze_word(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) analyzer.analyze() assert isinstance(analyzer.word, Preposition) assert analyzer.word.content == word
def test_match(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) matches = analyzer.match() assert matches is not None assert len(matches.span()) == 2
def test_analyze_processed_response(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) analyzer.analyze() assert analyzer.analyze() is None assert analyzer.analyze() is None
def test_analyze_processed(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) assert analyzer.processed is False analyzer.analyze() assert analyzer.processed is True
def test_match_empty(self): for word in self.INVALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) matches = analyzer.match() assert matches is None
def test_word_class(self): assert isinstance(PrepositionMorphologicalAnalyzer.word_class()(self.TEST_WORD), Preposition)
def test_initialize_processed(self): analyzer = PrepositionMorphologicalAnalyzer(self.TEST_WORD) # analyzer.matches is only populated after calling `analyze()` method assert analyzer.processed is False
def test_initialize_word(self): analyzer = PrepositionMorphologicalAnalyzer(self.TEST_WORD) # analyzer.word is only populated after calling `analyze()` method assert analyzer.word is None
def test_initialize_raw_word(self): analyzer = PrepositionMorphologicalAnalyzer(self.TEST_WORD) assert analyzer.raw_word == self.TEST_WORD
def test_initialize_overwrite_options(self): analyzer = PrepositionMorphologicalAnalyzer(self.TEST_WORD, dict(option='ok')) assert analyzer.options == dict(option='ok')
def test_initialize_default_options(self): analyzer = PrepositionMorphologicalAnalyzer(self.TEST_WORD) assert analyzer.options == dict()
def test_analyze_return_true(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) assert analyzer.analyze()
def test_analyze_match(self): for word in self.VALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) analyzer.analyze() assert analyzer.matches is not None
def test_prepositions_list(self): for word in PrepositionMorphologicalAnalyzer.PREPOSITIONS_LIST: analyzer = PrepositionMorphologicalAnalyzer(word) assert analyzer.analyze()
def test_invalid_analyze_word(self): for word in self.INVALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) analyzer.analyze() assert analyzer.word is None
def test_invalid_analyze(self): for word in self.INVALID_WORDS: analyzer = PrepositionMorphologicalAnalyzer(word) result = analyzer.analyze() assert not result