File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1111 cityscapes_root , svhn_root
1212
1313
14+ try :
15+ import scipy
16+ HAS_SCIPY = True
17+ except ImportError :
18+ HAS_SCIPY = False
19+
20+
1421class Tester (unittest .TestCase ):
1522 def generic_classification_dataset_test (self , dataset , num_images = 1 ):
1623 self .assertEqual (len (dataset ), num_images )
@@ -101,6 +108,7 @@ def test_fashionmnist(self, mock_download_extract):
101108 self .assertEqual (dataset .class_to_idx [dataset .classes [0 ]], target )
102109
103110 @mock .patch ('torchvision.datasets.utils.download_url' )
111+ @unittest .skipIf (not HAS_SCIPY , "scipy unavailable" )
104112 def test_imagenet (self , mock_download ):
105113 with imagenet_root () as root :
106114 dataset = torchvision .datasets .ImageNet (root , split = 'train' , download = True )
@@ -187,6 +195,7 @@ def test_cityscapes(self):
187195 self .assertTrue (isinstance (output [1 ][2 ], PIL .Image .Image )) # color
188196
189197 @mock .patch ('torchvision.datasets.SVHN._check_integrity' )
198+ @unittest .skipIf (not HAS_SCIPY , "scipy unavailable" )
190199 def test_svhn (self , mock_check ):
191200 mock_check .return_value = True
192201 with svhn_root () as root :
You can’t perform that action at this time.
0 commit comments