diff --git a/tests/test_pixel_ranges.py b/tests/test_pixel_ranges.py index 08855b8..f661395 100644 --- a/tests/test_pixel_ranges.py +++ b/tests/test_pixel_ranges.py @@ -10,6 +10,8 @@ def test_update_values_pixel_ranges(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -71,10 +73,14 @@ def _none_checker(_m1, _m2, start, stop, cov_mask): # None value: narrow range, no overlap. _none_checker(m1, m2, 200000, 200010, cov_mask) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + def test_update_values_pixel_ranges_empty(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -86,10 +92,14 @@ def test_update_values_pixel_ranges_empty(self): self.assertEqual(m1.n_valid, 0) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + def test_update_values_pixel_ranges_or(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -128,10 +138,14 @@ def test_update_values_pixel_ranges_or(self): testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels) testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels]) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + def test_update_values_pixel_ranges_and(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -170,10 +184,14 @@ def test_update_values_pixel_ranges_and(self): testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels) testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels]) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + def test_update_values_pixel_ranges_add(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -206,10 +224,14 @@ def test_update_values_pixel_ranges_add(self): testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels) testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels]) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + def test_set_bits_pix_pixel_ranges(self): nside_coverage = 32 nside_map = 256 + orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD + # Monkey-patch PIXEL_RANGE_THRESHOLD for testing. healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0 @@ -232,6 +254,8 @@ def test_set_bits_pix_pixel_ranges(self): testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels) testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels]) + healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold + if __name__ == '__main__': unittest.main()