@@ -144,7 +144,7 @@ def test_from_shape_zurich_pass(self):
144144 def test_from_shape_and_countries_zurich_pass (self ):
145145 """test initiating LitPop for custom shape (square around Zurich City)
146146 with from_shape_and_countries()"""
147-
147+
148148 ent = lp .LitPop .from_shape_and_countries (
149149 shape , 'Switzerland' , res_arcsec = 30 , reference_year = 2016 )
150150 self .assertEqual (ent .gdf .value .min (), 0.0 )
@@ -181,7 +181,7 @@ def test_Liechtenstein_30_pop_pass(self):
181181 self .assertAlmostEqual (ent .meta ['transform' ][0 ], 30 / 3600 )
182182
183183 def test_from_nightlight_intensity (self ):
184- """ Test raises, logger and if methods from_countries and from_shape are
184+ """ Test raises, logger and if methods from_countries and from_shape are
185185 are used."""
186186
187187 with self .assertRaises (ValueError ) as cm :
@@ -191,34 +191,35 @@ def test_from_nightlight_intensity(self):
191191 with self .assertRaises (ValueError ) as cm :
192192 lp .LitPop .from_nightlight_intensity (countries = 'Liechtenstein' , shape = shape )
193193 self .assertEqual ('Not allowed to set both `countries` and `shape`. Aborting.' , str (cm .exception ))
194-
195- exp = lp .LitPop .from_nightlight_intensity (countries = 'Liechtenstein' )
194+
195+ exp = lp .LitPop .from_nightlight_intensity (countries = 'Liechtenstein' )
196196 self .assertEqual (exp .fin_mode , 'none' )
197197
198- exp = lp .LitPop .from_nightlight_intensity (shape = shape )
198+ exp = lp .LitPop .from_nightlight_intensity (shape = shape )
199199 self .assertEqual (exp .value_unit , '' )
200-
200+
201201 with self .assertLogs ('climada.entity.exposures.litpop.litpop' , level = 'WARNING' ) as cm :
202202 lp .LitPop .from_nightlight_intensity (shape = shape )
203203 self .assertIn ('Note: set_nightlight_intensity sets values to raw nightlight intensity,' , cm .output [0 ])
204204
205205 def test_from_population (self ):
206- """ Test raises, logger and if methods from_countries and from_shape are
206+ """ Test raises, logger and if methods from_countries and from_shape are
207207 are used."""
208208
209209 with self .assertRaises (ValueError ) as cm :
210210 lp .LitPop .from_population ()
211211 self .assertEqual ('Either `countries` or `shape` required. Aborting.' , str (cm .exception ))
212212
213- exp = lp .LitPop .from_population (countries = 'Liechtenstein' )
213+ exp = lp .LitPop .from_population (countries = 'Liechtenstein' )
214214 self .assertEqual (exp .fin_mode , 'pop' )
215215
216- exp = lp .LitPop .from_population (shape = shape )
216+ exp = lp .LitPop .from_population (shape = shape )
217217 self .assertEqual (exp .value_unit , 'people' )
218218
219219 with self .assertRaises (ValueError ) as cm :
220220 lp .LitPop .from_population (countries = 'Liechtenstein' , shape = shape )
221- self .assertEqual ('Not allowed to set both `countries` and `shape`. Aborting.' , str (cm .exception ))
221+ self .assertEqual ('Not allowed to set both `countries` and `shape`. Aborting.' , str (cm .exception ))
222+
222223
223224class TestAdmin1 (unittest .TestCase ):
224225 """Test the admin1 functionalities within the LitPop module"""
@@ -309,7 +310,7 @@ def test_load_gpw_pop_shape_pass(self):
309310 self .assertEqual (meta ['height' ], data .shape [0 ])
310311 self .assertEqual (meta ['width' ], data .shape [1 ])
311312 self .assertIsInstance (data , np .ndarray )
312- self .assertEqual (len (data .shape ), 2 )
313+ self .assertEqual (len (data .shape ), 2 )
313314 except FileExistsError as err :
314315 self .assertIn ('lease download' , err .args [0 ])
315316 self .skipTest ('GPW input data for GPW v4.%i not found.' % (gpw_version ))
0 commit comments