1919 HAS_GEOPANDAS = False
2020
2121SCIPY1_7 = False
22- if scipy .version .version == ' 1.7.0' :
22+ if scipy .version .version . startswith ( " 1.7" ) :
2323 SCIPY1_7 = True
2424
25+
2526class Testutil (unittest .TestCase ):
2627 def setUp (self ):
2728 self .w = Rook .from_shapefile (examples .get_path ("10740.shp" ))
@@ -33,9 +34,8 @@ def test_lat2W(self):
3334 self .assertEqual (w9 .pct_nonzero , 29.62962962962963 )
3435 self .assertEqual (w9 [0 ], {1 : 1.0 , 3 : 1.0 })
3536 self .assertEqual (w9 [3 ], {0 : 1.0 , 4 : 1.0 , 6 : 1.0 })
36- @unittest .skipIf (
37- SCIPY1_7 , "Known failure due to dia change (TOFIX)"
38- )
37+
38+ @unittest .skipIf (SCIPY1_7 , "Known failure due to dia change (TOFIX)" )
3939 def test_lat2SW (self ):
4040 w9 = util .lat2SW (3 , 3 )
4141 rows , cols = w9 .shape
@@ -352,12 +352,16 @@ def test_fuzzy_contiguity(self):
352352 wf = fuzzy_contiguity (rs_df )
353353 self .assertEqual (wf .islands , [])
354354 self .assertEqual (set (wf .neighbors [0 ]), set ([239 , 59 , 152 , 23 ]))
355- buff = fuzzy_contiguity (rs_df , buffering = True , buffer = .2 )
356- self .assertEqual (set (buff .neighbors [0 ]), set ([175 , 119 , 239 , 59 , 152 , 246 , 23 , 107 ]))
357- rs_index = rs_df .set_index ('NM_MUNICIP' )
355+ buff = fuzzy_contiguity (rs_df , buffering = True , buffer = 0.2 )
356+ self .assertEqual (
357+ set (buff .neighbors [0 ]), set ([175 , 119 , 239 , 59 , 152 , 246 , 23 , 107 ])
358+ )
359+ rs_index = rs_df .set_index ("NM_MUNICIP" )
358360 index_w = fuzzy_contiguity (rs_index )
359- self .assertEqual (set (index_w .neighbors ['TAVARES' ]), set (['SÃO JOSÉ DO NORTE' , 'MOSTARDAS' ]))
360- wf_pred = fuzzy_contiguity (rs_df , predicate = 'touches' )
361+ self .assertEqual (
362+ set (index_w .neighbors ["TAVARES" ]), set (["SÃO JOSÉ DO NORTE" , "MOSTARDAS" ])
363+ )
364+ wf_pred = fuzzy_contiguity (rs_df , predicate = "touches" )
361365 self .assertEqual (set (wf_pred .neighbors [0 ]), set ([]))
362366 self .assertEqual (set (wf_pred .neighbors [1 ]), set ([142 , 82 , 197 , 285 , 386 , 350 ]))
363367
0 commit comments