def test_write(self): h = AdcircMesh(self.nodes, self.elements) tmpdir = tempfile.TemporaryDirectory() h.write(pathlib.Path(tmpdir.name) / 'test_AdcircMesh.gr3') h.write(pathlib.Path(tmpdir.name) / 'test_AdcircMesh.2dm', fmt='2dm') self.assertRaises(IOError, h.write, pathlib.Path(tmpdir.name) / 'test_AdcircMesh.2dm', fmt='2dm') self.assertRaises(IOError, h.write, pathlib.Path(tmpdir.name) / 'test_AdcircMesh.txt', fmt='txt')
def test_write(nodes, elements): output_directory = OUTPUT_DIRECTORY / 'test_write' if not output_directory.exists(): output_directory.mkdir(parents=True, exist_ok=True) mesh = AdcircMesh(nodes, elements) mesh.write(output_directory / 'test_AdcircMesh.gr3', overwrite=True) mesh.write(output_directory / 'test_AdcircMesh.2dm', format='2dm', overwrite=True) with pytest.raises(ValueError): mesh.write(output_directory / 'test_AdcircMesh.txt', format='txt', overwrite=True)