Skip to content

Commit 1826e92

Browse files
pmeierPhilip Meierfmassa
authored
add tests for Kinetics400 (#3457)
* add tests for Kinetics400 * use create_random_string() Co-authored-by: Philip Meier <[email protected]> Co-authored-by: Francisco Massa <[email protected]>
1 parent a7a2ee7 commit 1826e92

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/test_datasets.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,34 @@ def _create_lmdb(self, root, cls):
10031003

10041004
return num_images
10051005

1006+
def test_not_found_or_corrupted(self):
1007+
# LSUN does not raise built-in exception, but a custom one. It is expressive enough to not 'cast' it to
1008+
# RuntimeError or FileNotFoundError that are normally checked by this test.
1009+
with self.assertRaises(datasets_utils.lazy_importer.lmdb.Error):
1010+
super().test_not_found_or_corrupted()
1011+
1012+
1013+
class Kinetics400TestCase(datasets_utils.VideoDatasetTestCase):
1014+
DATASET_CLASS = datasets.Kinetics400
1015+
1016+
def inject_fake_data(self, tmpdir, config):
1017+
classes = ("Abseiling", "Zumba")
1018+
num_videos_per_class = 2
1019+
1020+
digits = string.ascii_letters + string.digits + "-_"
1021+
for cls in classes:
1022+
datasets_utils.create_video_folder(
1023+
tmpdir,
1024+
cls,
1025+
lambda _: f"{datasets_utils.create_random_string(11, digits)}.avi",
1026+
num_videos_per_class,
1027+
)
1028+
1029+
return num_videos_per_class * len(classes)
1030+
1031+
def test_not_found_or_corrupted(self):
1032+
self.skipTest("Dataset currently does not handle the case of no found videos.")
1033+
10061034

10071035
if __name__ == "__main__":
10081036
unittest.main()

0 commit comments

Comments
 (0)