Changeset 1869


Ignore:
Timestamp:
Oct 6, 2005, 10:20:31 AM (19 years ago)
Author:
ole
Message:

Investigated error conditions in least_squares.
NOTE: A test is currently failing

Location:
inundation/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/least_squares.py

    r1846 r1869  
    8181                 concatinate_attributelist
    8282
    83    
     83
    8484    try:
    8585        mesh_dict = import_mesh_file(mesh_file)
     
    8787        if display_errors:
    8888            print "Could not load bad file. ", e
    89         import sys; sys.exit()
     89        raise IOError  #Re-raise exception
     90       
    9091    vertex_coordinates = mesh_dict['vertices']
    9192    triangles = mesh_dict['triangles']
  • inundation/pyvolution/test_least_squares.py

    r1863 r1869  
    14911491            fit_to_mesh_file(mesh_file, point_file,
    14921492                             mesh_output_file, display_errors = False)
    1493         except SystemExit:  pass
     1493        except IOError:
     1494            pass
    14941495        else:
    1495             self.failUnless(0 ==1,  'Bad file did not raise error!')       
     1496            raise 'Bad file did not raise error!'
     1497           
    14961498        #clean up
    14971499        os.remove(mesh_file)
     
    15221524        fd.close()
    15231525
    1524         mesh_output_file = "e:\new_triangle.tsh" #Deliberately bad file
     1526        #FIXME (Ole): Is this a deliberately bad filename to invoke the error?
     1527        #There might be platform issus (Unix/Windows)
     1528        #In any case, the call itself does not raise an exception on cyclone - why?
     1529        mesh_output_file = "e:\new_triangle.tsh"
    15251530        try:
    15261531            fit_to_mesh_file(mesh_file, point_file,
    15271532                             mesh_output_file, display_errors = False)
    1528         except SystemExit:
     1533        except IOError:
    15291534            pass
    15301535        else:
    1531             #self.failUnless(0 ==1,  'Bad file did not raise error!')
    1532             #FIXME (Ole) Did not work on my computer: This one does:
    15331536            raise 'Bad file did not raise error!'
    15341537       
Note: See TracChangeset for help on using the changeset viewer.