class_docstr: Test case for image reading (jp2k).
class_docstr_tok: ["Test","case","for","image","reading","(","jp2k",")","."]
docstr: Test that saturated is masked with inf when requested and that calibration is performed.
docstr_tok: ["Test","that","saturated","is","masked","with","inf","when","requested","and","that","calibration","is","performed","."]
code: def test_calibration_and_masking(
      self, mask_saturated, calibration, expected
  ):
      """Test that saturated is masked with inf when requested and that calibration is performed."""
      from satpy.readers.msi_safe import SAFEMSIL1C, SAFEMSIMDXML
  
      mda = SAFEMSIMDXML(
          StringIO(mtd_l1c_xml),
          self.filename_info,
          mock.MagicMock(),
          mask_saturated=mask_saturated,
      )
      self.jp2_fh = SAFEMSIL1C(
          "somefile",
          self.filename_info,
          mock.MagicMock(),
          mda,
          self.tile_mda,
      )
  
      with mock.patch(
          "xarray.open_dataset", return_value=self.fake_data
      ):
          res = self.jp2_fh.get_dataset(
              make_dataid(name="B01", calibration=calibration),
              info=dict(),
          )
          np.testing.assert_allclose(res, expected)
  
file_path: satpy/satpy/tests/reader_tests/test_msi_safe.py
imports: import unittest.mock
  from io import BytesIO, StringIO
  import numpy
  import pytest
  import xarray
  from satpy.tests.utils import make_dataid
label_desc: Use image node_id 2 for calling the TestSAFEMSIL1C obj's underlying member method code with example usage: obj.test_calibration_and_masking(mask_saturated, calibration, expected) without return types