Changeset b345c45 in sasview for Invariant/test
- Timestamp:
- Jan 9, 2010 12:35:38 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 46d50ca
- Parents:
- 277aab4e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Invariant/test/utest_use_cases.py
r277aab4e rb345c45 9 9 10 10 class Data1D: 11 p rint "I am not of type Dataloader.Data1D"11 pass 12 12 13 13 class TestLineFit(unittest.TestCase): … … 96 96 def test_wrong_data(self): 97 97 """ test receiving Data1D not of type loader""" 98 # That just doesn;t make sense 98 99 99 100 wrong_data= Data1D() 101 invariant.InvariantCalculator(wrong_data) 102 100 103 try: 101 104 self.assertRaises(ValueError,invariant.InvariantCalculator(wrong_data)) … … 104 107 else: raise ValueError, "fail to raise exception when expected" 105 108 109 print "test" 110 self.assertRaises(ValueError,invariant.InvariantCalculator, wrong_data ) 106 111 107 112 def test_use_case_1(self): … … 439 444 440 445 # Get the volume fraction and surface 441 try: 442 self.assertRaises(RuntimeError, 443 inv.get_volume_fraction_with_error(contrast=2.6e-6)) 444 except RuntimeError, msg: 445 print "test pass : volume fraction is not defined for this data"+ str(msg) 446 else: raise ValueError, "fail to raise exception when expected" 447 448 try: 449 self.assertRaises(RuntimeError, 450 inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)) 451 except RuntimeError, msg: 452 print "test pass : surface is not defined for this data"+ str(msg) 453 else: raise ValueError, "fail to raise exception when expected" 446 self.assertRaises(RuntimeError, inv.get_volume_fraction_with_error, 2.6e-6) 447 448 # Check that an exception is raised when the 'surface' is not defined 449 self.assertRaises(RuntimeError, inv.get_surface_with_error, 2.6e-6, 2) 450 454 451 # Test results 455 452 self.assertAlmostEquals(qstar, 0.0045773,2) 453 456 454 457 455 … … 472 470 473 471 # Get the volume fraction and surface 474 try: 475 self.assertRaises(RuntimeError, 476 inv.get_volume_fraction_with_error(contrast=2.6e-6)) 477 except RuntimeError, msg: 478 print "test pass : volume fraction is not defined for this data"+ str(msg) 479 else: raise ValueError, "fail to raise exception when expected" 480 481 try: 482 self.assertRaises(RuntimeError, 483 inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)) 484 except RuntimeError, msg: 485 print "test pass : surface is not defined for this data"+ str(msg) 486 else: raise ValueError, "fail to raise exception when expected" 472 self.assertRaises(RuntimeError, inv.get_volume_fraction_with_error, 2.6e-6) 473 self.assertRaises(RuntimeError, inv.get_surface_with_error, 2.6e-6, 2) 474 487 475 # Test results 488 476 self.assertAlmostEquals(qstar, 0.00460319,3)
Note: See TracChangeset
for help on using the changeset viewer.