@@ -21,34 +21,11 @@ class TestUCMerced:
21
21
def dataset (
22
22
self , monkeypatch : MonkeyPatch , tmp_path : Path , request : SubRequest
23
23
) -> UCMerced :
24
- md5 = 'a42ef8779469d196d8f2971ee135f030'
25
- monkeypatch .setattr (UCMerced , 'md5' , md5 )
26
- url = os .path .join ('tests' , 'data' , 'ucmerced' , 'UCMerced_LandUse.zip' )
24
+ url = os .path .join ('tests' , 'data' , 'ucmerced' ) + os .sep
27
25
monkeypatch .setattr (UCMerced , 'url' , url )
28
- monkeypatch .setattr (
29
- UCMerced ,
30
- 'split_urls' ,
31
- {
32
- 'train' : os .path .join (
33
- 'tests' , 'data' , 'ucmerced' , 'uc_merced-train.txt'
34
- ),
35
- 'val' : os .path .join ('tests' , 'data' , 'ucmerced' , 'uc_merced-val.txt' ),
36
- 'test' : os .path .join ('tests' , 'data' , 'ucmerced' , 'uc_merced-test.txt' ),
37
- },
38
- )
39
- monkeypatch .setattr (
40
- UCMerced ,
41
- 'split_md5s' ,
42
- {
43
- 'train' : 'a01fa9f13333bb176fc1bfe26ff4c711' ,
44
- 'val' : 'a01fa9f13333bb176fc1bfe26ff4c711' ,
45
- 'test' : 'a01fa9f13333bb176fc1bfe26ff4c711' ,
46
- },
47
- )
48
- root = tmp_path
49
26
split = request .param
50
27
transforms = nn .Identity ()
51
- return UCMerced (root , split , transforms , download = True , checksum = True )
28
+ return UCMerced (tmp_path , split , transforms , download = True )
52
29
53
30
def test_getitem (self , dataset : UCMerced ) -> None :
54
31
x = dataset [0 ]
@@ -65,14 +42,14 @@ def test_add(self, dataset: UCMerced) -> None:
65
42
assert len (ds ) == 8
66
43
67
44
def test_already_downloaded (self , dataset : UCMerced , tmp_path : Path ) -> None :
68
- UCMerced (root = tmp_path , download = True )
45
+ UCMerced (tmp_path )
69
46
70
47
def test_already_downloaded_not_extracted (
71
48
self , dataset : UCMerced , tmp_path : Path
72
49
) -> None :
73
50
shutil .rmtree (dataset .root )
74
- shutil .copy (dataset .url , tmp_path )
75
- UCMerced (root = tmp_path , download = False )
51
+ shutil .copy (dataset .url + dataset . filename , tmp_path )
52
+ UCMerced (tmp_path )
76
53
77
54
def test_not_downloaded (self , tmp_path : Path ) -> None :
78
55
with pytest .raises (DatasetNotFoundError , match = 'Dataset not found' ):
0 commit comments