예제 #1
0
 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)
예제 #2
0
 def test_success_empty(self) -> None:
     # arrange
     kic = KnownImageCrawlers([])
     kic._list = []
     # act
     kic._test_duplicate_name('test')
     # assert
     self.assertTrue(True, 'no errors thrown')
예제 #3
0
 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')
예제 #4
0
 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])
예제 #5
0
 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)
예제 #6
0
 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])
예제 #7
0
 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])
예제 #8
0
 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)
예제 #9
0
 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)
예제 #10
0
 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)