|
1 |
| -import re |
2 |
| - |
3 | 1 | import pytest
|
4 | 2 | import torch
|
5 | 3 |
|
6 | 4 | from PIL import Image
|
7 | 5 |
|
8 |
| -from torchvision import datapoints, datasets |
| 6 | +from torchvision import datapoints |
9 | 7 | from torchvision.prototype import datapoints as proto_datapoints
|
10 | 8 |
|
11 | 9 |
|
@@ -163,43 +161,3 @@ def test_bbox_instance(data, format):
|
163 | 161 | if isinstance(format, str):
|
164 | 162 | format = datapoints.BoundingBoxFormat.from_str(format.upper())
|
165 | 163 | assert bboxes.format == format
|
166 |
| - |
167 |
| - |
168 |
| -class TestDatasetWrapper: |
169 |
| - def test_unknown_type(self): |
170 |
| - unknown_object = object() |
171 |
| - with pytest.raises( |
172 |
| - TypeError, match=re.escape("is meant for subclasses of `torchvision.datasets.VisionDataset`") |
173 |
| - ): |
174 |
| - datapoints.wrap_dataset_for_transforms_v2(unknown_object) |
175 |
| - |
176 |
| - def test_unknown_dataset(self): |
177 |
| - class MyVisionDataset(datasets.VisionDataset): |
178 |
| - pass |
179 |
| - |
180 |
| - dataset = MyVisionDataset("root") |
181 |
| - |
182 |
| - with pytest.raises(TypeError, match="No wrapper exist"): |
183 |
| - datapoints.wrap_dataset_for_transforms_v2(dataset) |
184 |
| - |
185 |
| - def test_missing_wrapper(self): |
186 |
| - dataset = datasets.FakeData() |
187 |
| - |
188 |
| - with pytest.raises(TypeError, match="please open an issue"): |
189 |
| - datapoints.wrap_dataset_for_transforms_v2(dataset) |
190 |
| - |
191 |
| - def test_subclass(self, mocker): |
192 |
| - sentinel = object() |
193 |
| - mocker.patch.dict( |
194 |
| - datapoints._dataset_wrapper.WRAPPER_FACTORIES, |
195 |
| - clear=False, |
196 |
| - values={datasets.FakeData: lambda dataset: lambda idx, sample: sentinel}, |
197 |
| - ) |
198 |
| - |
199 |
| - class MyFakeData(datasets.FakeData): |
200 |
| - pass |
201 |
| - |
202 |
| - dataset = MyFakeData() |
203 |
| - wrapped_dataset = datapoints.wrap_dataset_for_transforms_v2(dataset) |
204 |
| - |
205 |
| - assert wrapped_dataset[0] is sentinel |
0 commit comments