diff --git a/test/builtin_dataset_mocks.py b/test/builtin_dataset_mocks.py index a78ea098718..82bbea5494b 100644 --- a/test/builtin_dataset_mocks.py +++ b/test/builtin_dataset_mocks.py @@ -1329,20 +1329,20 @@ def cub200(info, root, config): @register_mock def eurosat(info, root, config): - data_folder = pathlib.Path(root, "eurosat", "2750") + data_folder = root / "2750" data_folder.mkdir(parents=True) num_examples_per_class = 3 - classes = ("AnnualCrop", "Forest") - for cls in classes: + categories = ["AnnualCrop", "Forest"] + for category in categories: create_image_folder( root=data_folder, - name=cls, - file_name_fn=lambda idx: f"{cls}_{idx}.jpg", + name=category, + file_name_fn=lambda idx: f"{category}_{idx + 1}.jpg", num_examples=num_examples_per_class, ) make_zip(root, "EuroSAT.zip", data_folder) - return len(classes) * num_examples_per_class + return len(categories) * num_examples_per_class @register_mock diff --git a/test/test_prototype_builtin_datasets.py b/test/test_prototype_builtin_datasets.py index 2855a490351..673158b00cd 100644 --- a/test/test_prototype_builtin_datasets.py +++ b/test/test_prototype_builtin_datasets.py @@ -53,6 +53,8 @@ def test_sample(self, test_home, dataset_mock, config): try: sample = next(iter(dataset)) + except StopIteration: + raise AssertionError("Unable to draw any sample.") from None except Exception as error: raise AssertionError("Drawing a sample raised the error above.") from error