diff --git a/tests/test_coordinates.py b/tests/test_coordinates.py new file mode 100644 index 0000000..adcfc12 --- /dev/null +++ b/tests/test_coordinates.py @@ -0,0 +1,41 @@ +import os +import unittest +from pathlib import Path + +import matplotlib.pyplot as plt +from dagmc_geometry_slice_plotter import get_slice_coordinates + + +class TestPlotSliceOfDagmcFile(unittest.TestCase): + """Tests the neutronics utilities functionality and use cases""" + + def setUp(self): + self.h5m_filename_smaller = "tests/dagmc.h5m" + + def test_create_default_plot(self): + """Tests returned object is a matplotlib plot""" + + list_of_coords = get_slice_coordinates( + dagmc_file_or_trimesh_object=self.h5m_filename_smaller, + ) + + for xy in list_of_coords: + plt.plot(*xy, color="black", linewidth=1) + + assert isinstance(list_of_coords, list) + + def test_create_default_plot_file(self): + """Tests output file creation""" + + os.system("rm test_plot.png") + + list_of_coords = get_slice_coordinates( + dagmc_file_or_trimesh_object=self.h5m_filename_smaller, + ) + + for xy in list_of_coords: + plt.plot(*xy, color="black", linewidth=1) + + + assert isinstance(list_of_coords, list) + # TODO consider making the function return lists of floats not a TrackedArray \ No newline at end of file diff --git a/tests/test_plot_slice_of_dagmc_file.py b/tests/test_plot_slice_of_dagmc_file.py index 8e82753..aeb9f54 100644 --- a/tests/test_plot_slice_of_dagmc_file.py +++ b/tests/test_plot_slice_of_dagmc_file.py @@ -1,11 +1,9 @@ import os -import tarfile import unittest -import urllib.request from pathlib import Path import matplotlib.pyplot as plt -from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_file +from dagmc_geometry_slice_plotter import plot_slice class TestPlotSliceOfDagmcFile(unittest.TestCase): @@ -17,8 +15,8 @@ def setUp(self): def test_create_default_plot(self): """Tests returned object is a matplotlib plot""" - plot = plot_slice_of_dagmc_file( - dagmc_filename=self.h5m_filename_smaller, + plot = plot_slice( + dagmc_file_or_trimesh_object=self.h5m_filename_smaller, ) assert isinstance(plot, type(plt)) @@ -28,8 +26,8 @@ def test_create_default_plot_file(self): os.system("rm test_plot.png") - plot = plot_slice_of_dagmc_file( - dagmc_filename=self.h5m_filename_smaller, + plot = plot_slice( + dagmc_file_or_trimesh_object=self.h5m_filename_smaller, ) plot.savefig("test_plot.png")