Esempio n. 1
0
 def test_appropriate_entitylist_none_arguments(self):
     """
     Test that None arguments are unacceptable
     :return:
     """
     test_object = EntityListBuilder(None)
     with self.assertRaises(AssertionError):
         test_object.get_appropriate_entitylist(None)
Esempio n. 2
0
 def test_unranked_is_always_plain_entity_list(self):
     """If the list is unranked, we always get a plain EntityList"""
     for option in [
             'knn', 'none', 'polynomial', 'exponential', 'svr', 'fake'
     ]:
         test_object = EntityListBuilder(option)
         entity_list = test_object.get_appropriate_entitylist(False)
         self.assertIsInstance(entity_list, EntityList)
Esempio n. 3
0
    def test_ranked_gives_correct_entity_list_subclass(self, mock_logger):
        """Check that we get the correct EntityList subclass if we have
         a ranked list"""
        test_object = EntityListBuilder('knn')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, KnnEntityList)

        test_object = EntityListBuilder('none')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, EntityList)

        test_object = EntityListBuilder('polynomial')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, PolynomialEntityList)

        test_object = EntityListBuilder('exponential')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, ExponentialEntityList)

        test_object = EntityListBuilder('svr')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, SvrEntityList)

        test_object = EntityListBuilder('fake')
        entity_list = test_object.get_appropriate_entitylist(True)
        self.assertIsInstance(entity_list, EntityList)
        mock_logger.assert_called_with("Unrecognised EntityList Type ("
                                       "'fake'). Returning an unranked "
                                       "EntityList.")