def test_get_sentence2(self):
        catalog1 = MockCatalog(1, 2)
        catalog1.find = MagicMock(return_value=EntityCollection([Entity("name01w1", "code01", "tag1"),
                                                                 Entity("name01w1 name01w2", "code11", "tag1", ["tag4add"])], "tag1"))
        catalog2 = MockCatalog(2, 1)
        catalog2.find = MagicMock(return_value=EntityCollection([Entity("name02", "code02", "tag2")], "tag2"))
        catalog3 = MockCatalog(3, 1)
        catalog3.find = MagicMock(return_value=EntityCollection([Entity("name03", "code03", "tag3")], "tag3"))
        catalog4 = MockCatalog(4, 1, ["tag4add"])
        catalog4.find = MagicMock(return_value=EntityCollection([Entity("name04", "code04", "tag4", ["tag4add"])], "tag4"))

        analyzer = SentenceAnalyzer()

        target = SentenceFinder(catalog_list=[catalog1, catalog2, catalog3, catalog4],
                                sentence_parser=SpacySentenceParser(),
                                sentence_analyzer=analyzer, tags_to_search=["tag2"],
                                tags_optional_to_search=["tag1", "tag3"], tags_to_exclude=["tag4add"])
        text = "The name01w1 name01w2 is the same as name11, but not name02, and name03 and name04 as well"
        title = "title"
        journal = "journal"
        actual = target.get_sentence(text, Article(title, "a text", journal, "123"))
        actual_collections = actual.entities_collections
        expected_collections = [EntityCollection([Entity("name02", "code02", "tag2")], "tag2"),
                                EntityCollection([Entity("name03", "code03", "tag3")], "tag3")]
        self.assertCountEqual(actual_collections, expected_collections)
    def test_if_tags(self):
        target = SentenceFinder(catalog_list=None, sentence_parser=None, sentence_analyzer=None,
                                tags_to_search=[BACTERIA_TAG],
                                tags_optional_to_search=[FOOD_TAG, DISEASE_TAG, NUTRIENT_TAG])
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, FOOD_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, DISEASE_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, NUTRIENT_TAG]))
        self.assertFalse(target.check_if_tags([BACTERIA_TAG, ALL_BACTERIA_TAG]))
        self.assertFalse(target.check_if_tags([BACTERIA_TAG]))

        target = SentenceFinder(catalog_list=[], sentence_parser=None, sentence_analyzer=None,
                                tags_to_search=[BACTERIA_TAG], tags_optional_to_search=[])
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, FOOD_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, DISEASE_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, NUTRIENT_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG, ALL_BACTERIA_TAG]))
        self.assertTrue(target.check_if_tags([BACTERIA_TAG]))
        self.assertFalse(target.check_if_tags([FOOD_TAG, DISEASE_TAG]))