Changeset 4160


Ignore:
Timestamp:
Jan 10, 2007, 2:23:45 PM (18 years ago)
Author:
ole
Message:

Better error message and untabifying

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py

    r4159 r4160  
    114114        import time
    115115
    116         #Create sww file of simple propagation from left to right
    117         #through rectangular domain
    118         from shallow_water import Domain, Dirichlet_boundary
     116        #Create sww file of simple propagation from left to right
     117        #through rectangular domain
     118        from shallow_water import Domain, Dirichlet_boundary
    119119        from mesh_factory import rectangular
    120120        from Numeric import take, concatenate, reshape
     
    130130
    131131        domain1.default_order = 2
    132         domain1.store = True
     132        domain1.store = True
    133133        domain1.set_datadir('.')
    134134        domain1.set_name('spatio_temporal_boundary_source_%d' %(id(self)))
     
    148148        finaltime = 8
    149149        #Evolution
    150         t0 = -1
     150        t0 = -1
    151151        for t in domain1.evolve(yieldstep = 0.1, finaltime = finaltime):
    152152            #print 'Timesteps: %.16f, %.16f' %(t0, t)
    153153            #if t == t0:
    154154            #    msg = 'Duplicate timestep found: %f, %f' %(t0, t)
    155             #   raise msg
    156             t0 = t
    157              
     155            #   raise msg
     156            t0 = t
     157             
    158158            #domain1.write_time()
    159159
     
    201201        msg = 'duplicate timesteps: %.16f and %.16f' %(T[-1], T[-2])
    202202        assert not T[-1] == T[-2], msg
    203         t = time[last_time_index]
     203        t = time[last_time_index]
    204204        q = f(t, point_id=0); assert allclose(r0, q)
    205205        q = f(t, point_id=1); assert allclose(r1, q)
     
    315315        import time
    316316
    317         #Create sww file of simple propagation from left to right
    318         #through rectangular domain
    319         from shallow_water import Domain, Dirichlet_boundary
     317        #Create sww file of simple propagation from left to right
     318        #through rectangular domain
     319        from shallow_water import Domain, Dirichlet_boundary
    320320        from mesh_factory import rectangular
    321321        from Numeric import take, concatenate, reshape
     
    334334       
    335335
    336         from anuga.utilities.numerical_tools import mean       
     336        from anuga.utilities.numerical_tools import mean       
    337337        domain1.reduction = mean
    338338        domain1.smooth = True #NOTE: Mimic sww output where each vertex has
     
    340340
    341341        domain1.default_order = 2
    342         domain1.store = True
     342        domain1.store = True
    343343        domain1.set_datadir('.')
    344344        domain1.set_name('spatio_temporal_boundary_source_%d' %(id(self)))
     
    378378        #Diagonal is identified by vertices: 0, 5, 10, 15
    379379
    380         last_time_index = len(time)-1 #Last last_time_index     
     380        last_time_index = len(time)-1 #Last last_time_index     
    381381        d_stage = reshape(take(stage[last_time_index, :], [0,5,10,15]), (4,1))
    382382        d_uh = reshape(take(xmomentum[last_time_index, :], [0,5,10,15]), (4,1))
     
    407407                          interpolation_points = d_midpoints)
    408408
    409         t = time[last_time_index]                        
     409        t = time[last_time_index]                        
    410410        q = f(t, point_id=0); assert allclose(r0, q)
    411411        q = f(t, point_id=1); assert allclose(r1, q)
     
    658658        #Check that domain.starttime isn't updated if later than file starttime but earlier
    659659        #than file end time
    660         delta = 23
     660        delta = 23
    661661        domain.starttime = start + delta
    662662        F = file_function(filename + '.sww', domain,
     
    875875        #Check that domain.starttime isn't updated if later than file starttime but earlier
    876876        #than file end time
    877         delta = 23
     877        delta = 23
    878878        domain.starttime = start + delta
    879879        F = file_function(filename + '.sww', domain,
     
    10341034        #Check that domain.starttime isn't updated if later than file starttime but earlier
    10351035        #than file end time
    1036         delta = 23
     1036        delta = 23
    10371037        domain.starttime = start + delta
    10381038        F = file_function(filename + '.tms', domain,
     
    11391139        """Test that obsolete call issues appropriate warning"""
    11401140
    1141         #Turn warning into an exception
     1141        #Turn warning into an exception
    11421142        import warnings
    1143         warnings.filterwarnings('error')
     1143        warnings.filterwarnings('error')
    11441144
    11451145        try:
    1146             assert point_on_line( 0, 0.5, 0,1, 0,0 )
    1147         except DeprecationWarning:
    1148             pass
    1149         else:
    1150             msg = 'point_on_line should have issued a DeprecationWarning'
    1151             raise Exception(msg)   
    1152 
    1153         warnings.resetwarnings()
     1146            assert point_on_line( 0, 0.5, 0,1, 0,0 )
     1147        except DeprecationWarning:
     1148            pass
     1149        else:
     1150            msg = 'point_on_line should have issued a DeprecationWarning'
     1151            raise Exception(msg)   
     1152
     1153        warnings.resetwarnings()
    11541154   
    11551155    def test_get_version_info(self):
     
    11621162            int(fields[1])
    11631163        except:
    1164             msg = 'Revision number must be an integer. I got %s' %fields[1]
     1164            msg = 'Revision number must be an integer. I got %s' %fields[1]
    11651165            msg += 'Chech that the command svn is on the system path'
    1166             raise Exception(msg)               
    1167        
     1166            raise Exception(msg)               
     1167       
    11681168    def test_add_directories(self):
    11691169       
     
    11931193        try:
    11941194            kens_dir = add_directories(root_dir, directories)
    1195         except OSError:
    1196             pass
    1197         else:
    1198             msg = 'bad dir name should give OSError'
    1199             raise Exception(msg)   
     1195        except OSError:
     1196            pass
     1197        else:
     1198            msg = 'bad dir name should give OSError'
     1199            raise Exception(msg)   
    12001200           
    12011201        #clean up!
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r4159 r4160  
    544544    # Create dummy info
    545545    info = 'Revision: Version info could not be obtained.'
    546     info += 'A command line version of svn and access to the '
     546    info += 'A command line version of svn must be availbable '
     547    info += 'on the system PATH, access to the subversion '
    547548    info += 'repository is necessary and the output must '
    548549    info += 'contain a line starting with "Revision:"'
     
    551552        fid = os.popen('svn info')
    552553    except:
    553         msg = 'svn is not recognised'
     554        msg = 'svn is not recognised on the system PATH'
    554555        warn(msg, UserWarning)
    555556    else:   
Note: See TracChangeset for help on using the changeset viewer.