- Timestamp:
- Feb 25, 2009, 9:37:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/shallow_water/test_shallow_water_domain.py
r6304 r6410 199 199 200 200 return 17.7 201 202 203 def scalar_func_list(t,x,y): 204 """Function that returns a scalar. 205 Used to test error message when numeric array is expected 206 """ 207 208 return [17.7] 201 209 202 210 … … 2462 2470 2463 2471 try: 2464 domain.forcing_terms.append(Wind_stress(s = scalar_func ,2472 domain.forcing_terms.append(Wind_stress(s = scalar_func_list, 2465 2473 phi = angle)) 2466 2474 except AssertionError: … … 2474 2482 domain.forcing_terms.append(Wind_stress(s = speed, 2475 2483 phi = scalar_func)) 2476 except AssertionError:2484 except Exception: 2477 2485 pass 2478 2486 else: … … 5582 5590 #print take(cv2, (0,3,8)) 5583 5591 5584 assert num.allclose( num.take(cv1, (0,8,16)), num.take(cv2, (0,3,8))) #Diag 5585 assert num.allclose( num.take(cv1, (0,6,12)), num.take(cv2, (0,1,4))) #Bottom 5586 assert num.allclose( num.take(cv1, (12,14,16)), num.take(cv2, (4,6,8))) #RHS 5592 assert num.allclose(num.take(cv1, (0,8,16), axis=0), 5593 num.take(cv2, (0,3,8), axis=0)) #Diag 5594 assert num.allclose(num.take(cv1, (0,6,12), axis=0), 5595 num.take(cv2, (0,1,4), axis=0)) #Bottom 5596 assert num.allclose(num.take(cv1, (12,14,16), axis=0), 5597 num.take(cv2, (4,6,8), axis=0)) #RHS 5587 5598 5588 5599 #Cleanup … … 5690 5701 5691 5702 #print points[0], points[5], points[10], points[15] 5692 msg = ('value was %s,\nshould be [[0,0], [1.0/3, 1.0/3], ' 5693 '[2.0/3, 2.0/3], [1,1]]' % str(num.take(points, [0,5,10,15]))) 5694 assert num.allclose(num.take(points, [0,5,10,15]), 5703 msg = ('value was\n%s\nshould be\n' 5704 '[[0,0], [1.0/3, 1.0/3],\n' 5705 '[2.0/3, 2.0/3], [1,1]]' 5706 % str(num.take(points, [0,5,10,15], axis=0))) 5707 assert num.allclose(num.take(points, [0,5,10,15], axis=0), 5695 5708 [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]]), msg 5696 5709 … … 5873 5886 5874 5887 #print points[0], points[5], points[10], points[15] 5875 msg = ('values was %s,\nshould be [[0,0], [1.0/3, 1.0/3], ' 5876 '[2.0/3, 2.0/3], [1,1]]' % str(num.take(points, [0,5,10,15]))) 5877 assert num.allclose(num.take(points, [0,5,10,15]), 5888 msg = ('values was\n%s\nshould be\n' 5889 '[[0,0], [1.0/3, 1.0/3],\n' 5890 '[2.0/3, 2.0/3], [1,1]]' 5891 % str(num.take(points, [0,5,10,15], axis=0))) 5892 assert num.allclose(num.take(points, [0,5,10,15], axis=0), 5878 5893 [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]]), msg 5879 5894 … … 6048 6063 6049 6064 #print points[0], points[5], points[10], points[15] 6050 msg = ('value was %s,\nshould be [[0,0], [1.0/3, 1.0/3], ' 6051 '[2.0/3, 2.0/3], [1,1]]' % str(num.take(points, [0,5,10,15]))) 6052 assert num.allclose(num.take(points, [0,5,10,15]), 6065 msg = ('value was\n%s\nshould be\n' 6066 '[[0,0], [1.0/3, 1.0/3],\n' 6067 '[2.0/3, 2.0/3], [1,1]]' 6068 % str(num.take(points, [0,5,10,15], axis=0))) 6069 assert num.allclose(num.take(points, [0,5,10,15], axis=0), 6053 6070 [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]]), msg 6054 6071 … … 6626 6643 6627 6644 if __name__ == "__main__": 6628 6629 suite = unittest.makeSuite(Test_Shallow_Water, 'test') 6630 #suite = unittest.makeSuite(Test_Shallow_Water, 'test_rainfall_forcing_with_evolve') 6631 #suite = unittest.makeSuite(Test_Shallow_Water,'test_get_energy_through_cross_section_with_g') 6632 #suite = unittest.makeSuite(Test_Shallow_Water,'test_fitting_using_shallow_water_domain') 6633 #suite = unittest.makeSuite(Test_Shallow_Water,'test_tight_slope_limiters') 6634 #suite = unittest.makeSuite(Test_Shallow_Water,'test_inflow_outflow_conservation') 6635 #suite = unittest.makeSuite(Test_Shallow_Water,'test_outflow_conservation_problem_temp') 6636 6637 6638 6645 #suite = unittest.makeSuite(Test_Shallow_Water, 'test') 6646 suite = unittest.makeSuite(Test_Shallow_Water, 'test_get_maximum_inundation_from_sww') 6639 6647 runner = unittest.TextTestRunner(verbosity=1) 6640 6648 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.