Skip to content

Commit

Permalink
Merge pull request #43 from lsst/tickets/DM-41648
Browse files Browse the repository at this point in the history
DM-41648: Make assertions as subTests
  • Loading branch information
arunkannawadi authored Dec 21, 2023
2 parents a3aa14e + f8b7366 commit 3e7b4d3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_validate_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def test_calexp(self):
# Uncomment following line to get replacement code when
# values need updating.
# print(f'("{name}", {name}, {var:.14f}),')
self.assertAlmostEqual(var, val, places=expected_places, msg=name)
with self.subTest(name):
self.assertAlmostEqual(var, val, places=expected_places, msg=name)

def test_background(self):
"""Test background level."""
Expand All @@ -111,8 +112,12 @@ def test_background(self):
bg_mean = bg0_arr.mean(dtype=np.float64)
bg_std = bg0_arr.std(dtype=np.float64)

self.assertAlmostEqual(bg_mean, 179.2837806173611, places=7, msg="calexpBackground mean")
self.assertAlmostEqual(bg_std, 0.8294872758615469, places=7, msg="calexpBackground stddev")
for name, var, val in (
("calexpBackground mean", bg_mean, 179.2837806173611),
("calexpBackground stddev", bg_std, 0.8294872758615469),
):
with self.subTest(name):
self.assertAlmostEqual(var, val, places=7, msg=name)

def test_ic_src(self):
"""Test icSrc catalog."""
Expand Down

0 comments on commit 3e7b4d3

Please sign in to comment.