def test_raise(self) -> None: # arrange known_ic_name = 'test' kic = KnownImageCrawlers([]) kic._list = [(known_ic_name, LoadableImageCrawlerA)] # act & assert with self.assertRaises(KeyError): kic._test_duplicate_name(known_ic_name)
def test_success_empty(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [] # act kic._test_duplicate_name('test') # assert self.assertTrue(True, 'no errors thrown')
def test_success_filled(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('testA', LoadableImageCrawlerA)] # act kic._test_duplicate_name('testB') # assert self.assertTrue(True, 'no errors thrown')
def test_items(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('test', LoadableImageCrawlerA)] # act ic_items = kic.items() # arrange self.assertListEqual(kic._list, [i for i in ic_items])
def test_success(self) -> None: kic = KnownImageCrawlers([]) kic._list = [] # act kic._add(_TEST_PLUGIN_ENTRY) # arrange self.assertListEqual([(_TEST_PLUGIN_ENTRY.name, _TEST_PLUGIN_CLASS)], kic._list)
def test_classes(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('test', LoadableImageCrawlerA)] # act ic_classes = kic.classes() # arrange self.assertListEqual([LoadableImageCrawlerA], [c for c in ic_classes])
def test_names(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('test', LoadableImageCrawlerA)] # act ic_names = kic.names() # arrange self.assertListEqual(['test'], [n for n in ic_names])
def test_raise(self) -> None: # arrange known_ic_class = LoadableImageCrawlerA kic = KnownImageCrawlers([]) kic._list = [('test', known_ic_class)] # act & assert with self.assertRaises(TypeError): kic._test_duplicate_class(known_ic_class)
def test_get_class(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('testKnown', LoadableImageCrawlerA)] # act ic_class_known = kic.get_class('testKnown') ic_class_unknown = kic.get_class('testUnknown') # arrange self.assertIs(LoadableImageCrawlerA, ic_class_known) self.assertIsNone(ic_class_unknown)
def test_get_name(self) -> None: # arrange kic = KnownImageCrawlers([]) kic._list = [('testKnown', LoadableImageCrawlerA)] # act ic_name_known = kic.get_name(LoadableImageCrawlerA) ic_name_unknown = kic.get_name(LoadableImageCrawlerB) # arrange self.assertEqual('testKnown', ic_name_known) self.assertIsNone(ic_name_unknown)