File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,20 @@ def fetch(*args, **kwargs):
15
15
return fetch_california_housing (* args , download_if_missing = False , ** kwargs )
16
16
17
17
18
- def test_fetch ():
18
+ def _is_california_housing_dataset_not_available ():
19
19
try :
20
- data = fetch ()
20
+ fetch_california_housing (download_if_missing = False )
21
+ return False
21
22
except IOError :
22
- raise SkipTest ("California housing dataset can not be loaded." )
23
+ return True
24
+
25
+
26
+ @pytest .mark .skipif (
27
+ _is_california_housing_dataset_not_available (),
28
+ reason = 'Download California Housing dataset to run this test'
29
+ )
30
+ def test_fetch ():
31
+ data = fetch ()
23
32
assert ((20640 , 8 ) == data .data .shape )
24
33
assert ((20640 , ) == data .target .shape )
25
34
@@ -28,6 +37,10 @@ def test_fetch():
28
37
check_return_X_y (data , fetch_func )
29
38
30
39
40
+ @pytest .mark .skipif (
41
+ _is_california_housing_dataset_not_available (),
42
+ reason = 'Download California Housing dataset to run this test'
43
+ )
31
44
def test_fetch_asframe ():
32
45
pd = pytest .importorskip ('pandas' )
33
46
bunch = fetch (as_frame = True )
You can’t perform that action at this time.
0 commit comments