Changeset 68a2c31 in sasview


Ignore:
Timestamp:
Dec 17, 2009 5:18:40 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
0957dbdb
Parents:
6311713
Message:

making some test pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/test/utest_use_cases.py

    r6311713 r68a2c31  
    363363         
    364364        # Get the volume fraction and surface 
    365         #This calculation should have an error. 
    366         #v, dv = inv.get_volume_fraction_with_error(contrast=2.6e-6) 
    367         #s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2) 
    368          
     365        try: 
     366            self.assertRaises(RuntimeError, 
     367                              inv.get_volume_fraction_with_error(contrast=2.6e-6)) 
     368        except RuntimeError, msg: 
     369            print "test pass : volume fraction is not defined for this data"+ str(msg) 
     370        else: raise ValueError, "fail to raise exception when expected" 
     371         
     372        try: 
     373            self.assertRaises(RuntimeError, 
     374                 inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)) 
     375        except RuntimeError, msg: 
     376            print "test pass : surface is not defined for this data"+ str(msg) 
     377        else: raise ValueError, "fail to raise exception when expected" 
    369378        # Test results 
    370379        self.assertAlmostEquals(qstar, 0.0045773,2) 
    371         #self.assertAlmostEquals(v, 0.127225804) 
    372         #self.assertAlmostEquals(s+ _ERR_SURFACE, 9.42e+2, 1) 
     380         
    373381        
    374382    def test_use_case_5(self): 
     
    388396         
    389397        # Get the volume fraction and surface 
    390         #This calculation should have an error. 
    391         #v, dv = inv.get_volume_fraction_with_error(contrast=2.6e-6) 
    392         #s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2) 
    393          
     398        try: 
     399            self.assertRaises(RuntimeError, 
     400                              inv.get_volume_fraction_with_error(contrast=2.6e-6)) 
     401        except RuntimeError, msg: 
     402            print "test pass : volume fraction is not defined for this data"+ str(msg) 
     403        else: raise ValueError, "fail to raise exception when expected" 
     404         
     405        try: 
     406            self.assertRaises(RuntimeError, 
     407                 inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)) 
     408        except RuntimeError, msg: 
     409            print "test pass : surface is not defined for this data"+ str(msg) 
     410        else: raise ValueError, "fail to raise exception when expected" 
    394411        # Test results 
    395412        self.assertAlmostEquals(qstar, 0.00460319,3) 
    396         #self.assertAlmostEquals(v, 0.202846825) 
    397         #self.assertAlmostEquals(s+ _ERR_SURFACE, 9.42e+2, 1) 
     413       
Note: See TracChangeset for help on using the changeset viewer.