Skip to content

Commit

Permalink
add tests for Kinetics400 (#3457)
Browse files Browse the repository at this point in the history
* add tests for Kinetics400

* use create_random_string()

Co-authored-by: Philip Meier <pmeier.github@posteo.de>
Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
  • Loading branch information
3 people authored Mar 1, 2021
1 parent a7a2ee7 commit 1826e92
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,34 @@ def _create_lmdb(self, root, cls):

return num_images

def test_not_found_or_corrupted(self):
# LSUN does not raise built-in exception, but a custom one. It is expressive enough to not 'cast' it to
# RuntimeError or FileNotFoundError that are normally checked by this test.
with self.assertRaises(datasets_utils.lazy_importer.lmdb.Error):
super().test_not_found_or_corrupted()


class Kinetics400TestCase(datasets_utils.VideoDatasetTestCase):
DATASET_CLASS = datasets.Kinetics400

def inject_fake_data(self, tmpdir, config):
classes = ("Abseiling", "Zumba")
num_videos_per_class = 2

digits = string.ascii_letters + string.digits + "-_"
for cls in classes:
datasets_utils.create_video_folder(
tmpdir,
cls,
lambda _: f"{datasets_utils.create_random_string(11, digits)}.avi",
num_videos_per_class,
)

return num_videos_per_class * len(classes)

def test_not_found_or_corrupted(self):
self.skipTest("Dataset currently does not handle the case of no found videos.")


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

0 comments on commit 1826e92

Please sign in to comment.