Example #1
0
    def test_analyze_word(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            analyzer.analyze()

            assert isinstance(analyzer.word, Conjunction)
            assert analyzer.word.content == word
Example #2
0
    def test_match(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            matches = analyzer.match()

            assert matches is not None
            assert len(matches.span()) == 2
Example #3
0
    def test_analyze_processed_response(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            analyzer.analyze()

            assert analyzer.analyze() is None
            assert analyzer.analyze() is None
Example #4
0
    def test_analyze_processed(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)

            assert analyzer.processed is False

            analyzer.analyze()

            assert analyzer.processed is True
Example #5
0
    def test_match_empty(self):
        for word in self.INVALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            matches = analyzer.match()

            assert matches is None
Example #6
0
 def test_word_class(self):
     assert isinstance(
         ConjunctionMorphologicalAnalyzer.word_class()(self.TEST_WORD),
         Conjunction)
Example #7
0
    def test_initialize_processed(self):
        analyzer = ConjunctionMorphologicalAnalyzer(self.TEST_WORD)

        # analyzer.matches is only populated after calling `analyze()` method
        assert analyzer.processed is False
Example #8
0
    def test_initialize_word(self):
        analyzer = ConjunctionMorphologicalAnalyzer(self.TEST_WORD)

        # analyzer.word is only populated after calling `analyze()` method
        assert analyzer.word is None
Example #9
0
    def test_initialize_raw_word(self):
        analyzer = ConjunctionMorphologicalAnalyzer(self.TEST_WORD)

        assert analyzer.raw_word == self.TEST_WORD
Example #10
0
    def test_initialize_overwrite_options(self):
        analyzer = ConjunctionMorphologicalAnalyzer(self.TEST_WORD,
                                                    dict(option='ok'))

        assert analyzer.options == dict(option='ok')
Example #11
0
    def test_initialize_default_options(self):
        analyzer = ConjunctionMorphologicalAnalyzer(self.TEST_WORD)

        assert analyzer.options == dict()
Example #12
0
    def test_analyze_return_true(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)

            assert analyzer.analyze()
Example #13
0
    def test_analyze_match(self):
        for word in self.VALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            analyzer.analyze()

            assert analyzer.matches is not None
Example #14
0
    def test_conjunctions_list(self):
        for word in ConjunctionMorphologicalAnalyzer.CONJUNCTIONS_LIST:
            analyzer = ConjunctionMorphologicalAnalyzer(word)

            assert analyzer.analyze()
Example #15
0
    def test_invalid_analyze_word(self):
        for word in self.INVALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            analyzer.analyze()

            assert analyzer.word is None
Example #16
0
    def test_invalid_analyze(self):
        for word in self.INVALID_WORDS:
            analyzer = ConjunctionMorphologicalAnalyzer(word)
            result = analyzer.analyze()

            assert not result