Skip to content

Commit

Permalink
Merge pull request #2648 from ArrayBolt3/arraybolt3/fix_assert_called…
Browse files Browse the repository at this point in the history
…_once

Fix assert_called_once usage in resample tests
  • Loading branch information
djhoese committed Nov 26, 2023
2 parents f2f1b33 + 43ab244 commit 684f364
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions satpy/tests/scene_tests/test_resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,20 @@ def test_resample_reduce_data_toggle(self, rs):
ds_walker.return_value = test_order
slice_data.side_effect = orig_slice_data
scene.resample(target_area, reduce_data=False)
assert not slice_data.called
assert not get_area_slices.called
slice_data.assert_not_called()
get_area_slices.assert_not_called()
scene.resample(target_area)
assert slice_data.called_once
assert get_area_slices.called_once
assert slice_data.call_count == 3
assert get_area_slices.call_count == 1
assert get_area_slices_big.call_count == 1
scene.resample(target_area, reduce_data=True)
# 2 times for each dataset
# once for default (reduce_data=True)
# once for kwarg forced to `True`
assert slice_data.call_count == 2 * 3
assert get_area_slices.called_once
# get area slices is called again, once per area
assert get_area_slices.call_count == 2
assert get_area_slices_big.call_count == 2

def test_resample_ancillary(self):
"""Test that the Scene reducing data does not affect final output."""
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/writer_tests/test_ninjogeotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def test_write_and_read_file_units(
np.testing.assert_allclose(float(tgs["ninjo_Gradient"]),
0.467717, rtol=1e-5)
np.testing.assert_allclose(float(tgs["ninjo_AxisIntercept"]),
-79.86771)
-79.86771, rtol=1e-5)
fn2 = os.fspath(tmp_path / "test2.tif")
with caplog.at_level(logging.WARNING):
ngtw.save_dataset(
Expand Down

0 comments on commit 684f364

Please sign in to comment.