Add test for list data resolver
This commit is contained in:
parent
326d861a86
commit
09d95fac58
|
@ -116,4 +116,22 @@ class TestResolve(unittest.TestCase):
|
|||
self.assertEqual(captions, ['caption for test1', 'caption for test2', 'test3'])
|
||||
|
||||
undersized_images = list(filter(lambda i: i.is_undersized, items))
|
||||
self.assertEqual(len(undersized_images), 1)
|
||||
self.assertEqual(len(undersized_images), 1)
|
||||
|
||||
def test_resolve_with_list(self):
|
||||
data_root_spec = [
|
||||
DATA_PATH,
|
||||
JSON_ROOT_PATH,
|
||||
]
|
||||
|
||||
items = resolver.resolve(data_root_spec, ARGS)
|
||||
image_paths = [item.pathname for item in items]
|
||||
image_captions = [item.caption for item in items]
|
||||
captions = [caption.get_caption() for caption in image_captions]
|
||||
|
||||
self.assertEqual(len(items), 6)
|
||||
self.assertEqual(image_paths, [IMAGE_1_PATH, IMAGE_2_PATH, IMAGE_3_PATH] * 2)
|
||||
self.assertEqual(captions, ['caption for test1', 'test2', 'test3', 'caption for test1', 'caption for test2', 'test3'])
|
||||
|
||||
undersized_images = list(filter(lambda i: i.is_undersized, items))
|
||||
self.assertEqual(len(undersized_images), 2)
|
Loading…
Reference in New Issue