- Timestamp:
- Mar 4, 2009, 8:26:22 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/coordinate_transforms/test_geo_reference.py
r6428 r6441 239 239 new_points = g.get_absolute(points) 240 240 241 self.failUnless( type(new_points) == types.ListType, 'failed')241 self.failUnless(isinstance(new_points, list), 'failed') 242 242 self.failUnless(type(new_points) == type(points), 'failed') 243 243 for point, new_point in map(None, points, new_points): … … 250 250 new_points = g.get_absolute(points) 251 251 252 self.failUnless( type(new_points) == types.ListType, 'failed')252 self.failUnless(isinstance(new_points, list), 'failed') 253 253 self.failUnless(type(new_points) == type(points), 'failed') 254 254 for point, new_point in map(None, points, new_points): … … 259 259 # first call 260 260 dx = 10.0 261 dy = 1 0.0261 dy = 12.0 262 262 g = Geo_reference(56, dx, dy) 263 263 points = [[3.0,34.0], [64.0,6.0]] … … 265 265 new_points = g.get_absolute(points) 266 266 267 self.failUnless(type(new_points) == types.ListType, 'failed') 268 self.failUnless(type(new_points) == type(points), 'failed') 269 for point, new_point in map(None, expected_new_points, new_points): 270 self.failUnless(point[0] == new_point[0], 'failed') 271 self.failUnless(point[1] == new_point[1], 'failed') 267 self.failUnless(isinstance(new_points, list), 'failed') 268 self.failUnless(type(new_points) == type(points), 'failed') 269 self.failUnless(new_points == expected_new_points, 'failed') 272 270 273 271 # and repeat from 'new_points = g.get_absolute(points)' above … … 275 273 new_points = g.get_absolute(points) 276 274 277 self.failUnless(type(new_points) == types.ListType, 'failed') 278 self.failUnless(type(new_points) == type(points), 'failed') 279 for point, new_point in map(None, expected_new_points, new_points): 280 self.failUnless(point[0] == new_point[0], 'failed') 281 self.failUnless(point[1] == new_point[1], 'failed') 275 self.failUnless(isinstance(new_points, list), 'failed') 276 self.failUnless(type(new_points) == type(points), 'failed') 277 self.failUnless(new_points == expected_new_points, 'failed') 282 278 283 279 def test_get_absolute_array(self): … … 294 290 self.failUnless(isinstance(new_points, num.ndarray), 'failed') 295 291 self.failUnless(type(new_points) == type(points), 'failed') 296 self.failUnless(num.alltrue(points == new_points), 'failed') 292 msg = 'points=\n%s\nnew_points=\n%s' % (str(points), str(new_points)) 293 for point, new_point in map(None, points, new_points): 294 self.failUnless(point[0]+x == new_point[0], 'failed') 295 self.failUnless(point[1]+y == new_point[1], 'failed') 297 296 298 297 # test with no supplied offsets … … 307 306 # test that calling get_absolute twice does the right thing 308 307 # first call 309 dx = 1 0.0310 dy = 1 0.0308 dx = 11.0 309 dy = 13.0 311 310 g = Geo_reference(56, dx, dy) 312 311 points = num.array([[3.0,34.0], [64.0,6.0]]) … … 336 335 self.failUnless(isinstance(new_points, num.ndarray), 'failed') 337 336 self.failUnless(type(new_points) == type(points), 'failed') 338 msg = (' Second call of .get_absolute() returned %s\nexpected %s'337 msg = ('Third call of .get_absolute() returned %s\nexpected %s' 339 338 % (str(new_points), str(expected_new_points))) 340 339 self.failUnless(num.alltrue(expected_new_points == new_points), msg) … … 534 533 if __name__ == "__main__": 535 534 suite = unittest.makeSuite(geo_referenceTestCase, 'test') 536 #suite = unittest.makeSuite(geo_referenceTestCase, 'test_functionality_get_absolute')537 535 runner = unittest.TextTestRunner() #verbosity=2) 538 536 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.