From 7704fc437b4d612f46214a1ce811e8769e965129 Mon Sep 17 00:00:00 2001 From: Joseph Capriotti Date: Tue, 30 May 2023 15:54:26 -0700 Subject: [PATCH] add mixin tests --- tests/cyl/test_cyl_io.py | 45 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/tests/cyl/test_cyl_io.py b/tests/cyl/test_cyl_io.py index ee3c559c0..3f133325a 100644 --- a/tests/cyl/test_cyl_io.py +++ b/tests/cyl/test_cyl_io.py @@ -1,28 +1,47 @@ import discretize import pytest import os +import numpy as np -def test_convert_to_vtk(): +def test_convert_zero_wrapped_to_vtk(): mesh = discretize.CylindricalMesh([20, 15, 10]) mesh.to_vtk() -def test_bad_convert(): - mesh = discretize.CylindricalMesh([20, 2, 10]) - with pytest.raises(NotImplementedError): - mesh.to_vtk() +def test_convert_zero_nonwrapped_to_vtk(): + mesh = discretize.CylindricalMesh([20, np.ones(3), 10]) + mesh.to_vtk() + + +def test_convert_nonzero_wrapped_to_vtk(): + mesh = discretize.CylindricalMesh([20, 15, 10], origin=[1, 0, 0]) + mesh.to_vtk() + + +def test_convert_nonzero_nonwrapped_to_vtk(): + mesh = discretize.CylindricalMesh([20, np.ones(3), 10], origin=[1, 0, 0]) + mesh.to_vtk() + + +def test_convert_zero_wrapped_plot_grid(): + mesh = discretize.CylindricalMesh([20, 15, 10]) + mesh.plot_grid() + + +def test_convert_zero_nonwrapped_plot_grid(): + mesh = discretize.CylindricalMesh([20, np.ones(3), 10]) + mesh.plot_grid() + - mesh = discretize.CylindricalMesh([20, 1, 10]) - with pytest.raises(NotImplementedError): - mesh.to_vtk() +def test_convert_nonzero_wrapped_plot_grid(): + mesh = discretize.CylindricalMesh([20, 15, 10], origin=[1, 0, 0]) + mesh.plot_grid() -def test_serialize(): - mesh = discretize.CylindricalMesh([20, 10, 3]) - mesh.save("test.cyl") - mesh2 = discretize.load_mesh("test.cyl") - assert mesh.equals(mesh2) +def test_convert_nonzero_nonwrapped_plot_grid(): + mesh = discretize.CylindricalMesh([20, np.ones(3), 10], origin=[1, 0, 0]) + mesh.plot_grid() @pytest.fixture(autouse=True)