Skip to content

Commit

Permalink
add mixin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed May 30, 2023
1 parent e515223 commit 7704fc4
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions tests/cyl/test_cyl_io.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 7704fc4

Please sign in to comment.