Skip to content

Commit

Permalink
Update UnitTesting for figure generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahshi committed Feb 27, 2024
1 parent 046d344 commit d49d26b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion UnitTests/test_fittingfunc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import glob
import unittest
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -201,8 +202,12 @@ def test_MCMC_exportpath(self):
temp_export_path,
"output.csv")))

figure_files = glob.glob(os.path.join(temp_export_path, "*.pdf"))
self.assertTrue(len(figure_files) > 0, "No figure files found in the export path.")

# Cleanup
os.remove(os.path.join(temp_export_path, "output.csv"))
for file_path in glob.glob(os.path.join(temp_export_path, "*")):
os.remove(file_path)
os.rmdir(temp_export_path)


Expand Down
5 changes: 5 additions & 0 deletions UnitTests/test_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@ def test_chemistry_thickness_path_none(self):
loader = pig.SampleDataLoader(chemistry_thickness_path=None)
loader.load_chemistry_thickness()

def test_spectrum_chemistry_thickness_path_none(self):
with self.assertRaises(ValueError):
loader = pig.SampleDataLoader(spectrum_path=None, chemistry_thickness_path=None)
loader.load_all_data()

if __name__ == '__main__':
unittest.main()
5 changes: 0 additions & 5 deletions UnitTests/test_thickness.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,5 @@ def test_process_thickness(self):
except Exception as e:
self.fail(f"Unexpected exception occurred: {e}")

def test_invalid_wavenumber_range(self):

with self.assertRaises(ValueError):
pig.calculate_mean_thickness(self.dfs_dict, 1.546, self.wn_high_gl, self.wn_low_gl)

if __name__ == '__main__':
unittest.main()

0 comments on commit d49d26b

Please sign in to comment.