def test_basic(self):
     result = product_definition_template_9(self.section, self.metadata, self.frt_coord)
     # Check expected function was called.
     self.assertEqual(self.patch_pdt8_call.call_args_list, [mock.call(self.section, self.metadata, self.frt_coord)])
     # Check metadata content (N.B. cell_method has been removed!).
     self.assertEqual(self.metadata, {"cell_methods": [], "aux_coords_and_dims": []})
     # Check result.
     self.assertEqual(result, Probability("above_threshold", 5.3))
 def test_basic(self):
     result = product_definition_template_9(
         self.section, self.metadata, self.frt_coord)
     # Check expected function was called.
     self.assertEqual(
         self.patch_pdt8_call.call_args_list,
         [mock.call(self.section, self.metadata, self.frt_coord)])
     # Check metadata content (N.B. cell_method has been removed!).
     self.assertEqual(self.metadata, {'cell_methods': [],
                                      'aux_coords_and_dims': []})
     # Check result.
     self.assertEqual(result, Probability('above_threshold', 5.3))
 def test_fail_bad_threshold_scalefactor(self):
     self.section['scaleFactorOfUpperLimit'] = _MDI
     with self.assertRaisesRegexp(TranslationError,
                                  'missing scale factor'):
         product_definition_template_9(
             self.section, self.metadata, self.frt_coord)
 def test_fail_bad_probability_type(self):
     self.section['probabilityType'] = 17
     with self.assertRaisesRegexp(TranslationError,
                                  'unsupported probability type'):
         product_definition_template_9(
             self.section, self.metadata, self.frt_coord)
 def test_fail_bad_threshold_scalefactor(self):
     self.section['scaleFactorOfUpperLimit'] = _MDI
     with self.assertRaisesRegexp(TranslationError,
                                  'missing scale factor'):
         product_definition_template_9(
             self.section, self.metadata, self.frt_coord)
 def test_fail_bad_probability_type(self):
     self.section['probabilityType'] = 17
     with self.assertRaisesRegexp(TranslationError,
                                  'unsupported probability type'):
         product_definition_template_9(
             self.section, self.metadata, self.frt_coord)
 def test_fail_bad_threshold_value(self):
     self.section["scaledValueOfUpperLimit"] = _MDI
     with self.assertRaisesRegexp(TranslationError, "missing scaled value"):
         product_definition_template_9(self.section, self.metadata, self.frt_coord)