Skip to content
Snippets Groups Projects
Commit 52356f68 authored by Veronique Legrand's avatar Veronique Legrand
Browse files

modified test to check that generated graph is always the same

parent 0cb2d9f6
No related branches found
No related tags found
2 merge requests!108Fixing py 3.12,!107Draft: changed the loading of data required to draw the global plot; now read only 3...
...@@ -39,7 +39,7 @@ def create_global_plot(work_file_path: str, global_plot_path: str): ...@@ -39,7 +39,7 @@ def create_global_plot(work_file_path: str, global_plot_path: str):
""" """
regions = read_hdf(work_file_path, "Regions") regions = read_hdf(work_file_path, "Regions")
chr_length = regions.groupby('CHR').max().position #chr_length = regions.groupby('CHR').max().position
N_reg= regions.Region.max() N_reg= regions.Region.max()
maxy = 0 maxy = 0
......
jass/test/expected_graphs/expected_global_plot.png

321 KiB

...@@ -12,10 +12,12 @@ from . import JassTestCase ...@@ -12,10 +12,12 @@ from . import JassTestCase
class TestPlots(JassTestCase): class TestPlots(JassTestCase):
test_folder = "data_real" test_folder = "data_real"
expected_res_folder = "expected_graphs"
def setUp(self): def setUp(self):
# Create a temporary directory # Create a temporary directory
self.test_dir = Path(tempfile.mkdtemp()) self.test_dir = Path(tempfile.mkdtemp())
self.ref_res_dir=Path(os.path.join(os.path.dirname(os.path.abspath(__file__)), self.expected_res_folder))
self.worktable_hdf_path = self.get_file_path_fn("worktable-withnans.hdf5") self.worktable_hdf_path = self.get_file_path_fn("worktable-withnans.hdf5")
def tearDown(self): def tearDown(self):
...@@ -25,6 +27,15 @@ class TestPlots(JassTestCase): ...@@ -25,6 +27,15 @@ class TestPlots(JassTestCase):
def test_create_global_plot(self): def test_create_global_plot(self):
plots.create_global_plot(self.worktable_hdf_path, self.test_dir / "global_plot.png") plots.create_global_plot(self.worktable_hdf_path, self.test_dir / "global_plot.png")
#plots.create_global_plot(self.worktable_hdf_path, "/Users/vlegrand/tmp/global_plot.png")
fnew=open(self.test_dir / "global_plot.png",'rb')
fref=open(self.ref_res_dir / "expected_global_plot.png",'rb')
content_new=fnew.read()
content_ref=fref.read()
assert(content_new==content_ref)
fnew.close()
fref.close()
def test_create_qq_plot(self): def test_create_qq_plot(self):
plots.create_qq_plot(self.worktable_hdf_path, self.test_dir / "qq_plot.png") plots.create_qq_plot(self.worktable_hdf_path, self.test_dir / "qq_plot.png")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment