Ejemplo n.º 1
0
def test_adhmodel_read_mesh():
    # set test project name
    project_name = 'SanDiego'
    # set project directory
    path = os.path.join(TESTDIR, 'test_files', project_name)
    # instantiate empty adh model object
    adhmod = AdhModel()
    # read the mesh file
    adhmod.read_mesh(path=path, project_name=project_name, crs=None, fmt='nc')
Ejemplo n.º 2
0
 def test_bad_format_e3t(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, 'bad_mesh_e3t.3dm')
     model = AdhModel()
     with self.assertRaises(ValueError) as context:
         model.read_mesh(fname, fmt='3dm')
     # self.assertTrue('Error reading element (E3T) record from file on line 3.' in str(context.exception))
     self.assertTrue(
         "list.remove(x): x not in list" in str(context.exception))
Ejemplo n.º 3
0
 def test_read_mesh_file(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, 'angle_bt.3dm')
     out_file = os.path.join(path, 'out_files', 'out_angle_bt.3dm')
     base_file = os.path.join(path, 'base_angle_bt2.3dm')
     model = AdhModel()
     model.read_mesh(fname, fmt='3dm')
     model.write_mesh(out_file, fmt='3dm')
     self.assertTrue(filecmp.cmp(base_file, out_file))
Ejemplo n.º 4
0
 def test_bad_format_nds(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, 'bad_mesh_nds.3dm')
     model = AdhModel()
     with self.assertRaises(UnboundLocalError) as context:
         model.read_mesh(fname, fmt='3dm')
     # self.assertTrue('Error reading node (ND) record from file on line 2.' in str(context.exception))
     self.assertTrue(
         "local variable 'extra_cols' referenced before assignment" in str(
             context.exception))