コード例 #1
0
 def test_create_thresholds(self):
     roc_check = self._mommy_make_rate_of_change_check()
     threshold = RateOfChangeThreshold(rate_of_change_check=roc_check,
                                       delta_t="10min",
                                       allowed_diff=25.0)
     threshold.save()
     self.assertEqual(RateOfChangeThreshold.objects.count(), 1)
コード例 #2
0
 def test_raises_data_error_if_invalid_delta_t(self):
     roc_check = self._mommy_make_rate_of_change_check()
     threshold = RateOfChangeThreshold(rate_of_change_check=roc_check,
                                       delta_t="garbag",
                                       allowed_diff=25.0)
     msg = '"garbag" is not a valid delta_t'
     with self.assertRaisesRegex(DataError, msg):
         threshold.save()
コード例 #3
0
 def test_delta_t_with_days(self):
     self.assertTrue(RateOfChangeThreshold.is_delta_t_valid("3D"))
コード例 #4
0
 def test_delta_t_with_hours(self):
     self.assertTrue(RateOfChangeThreshold.is_delta_t_valid("2H"))
コード例 #5
0
 def test_delta_t_with_minutes(self):
     self.assertTrue(RateOfChangeThreshold.is_delta_t_valid("1min"))
コード例 #6
0
 def test_delta_t_with_invalid_unit_of_measurement_is_invalid(self):
     self.assertFalse(RateOfChangeThreshold.is_delta_t_valid("2garbg"))
コード例 #7
0
 def test_zero_delta_t_is_invalid(self):
     self.assertFalse(RateOfChangeThreshold.is_delta_t_valid("0min"))
コード例 #8
0
 def test_garbage_delta_t_is_invalid(self):
     self.assertFalse(RateOfChangeThreshold.is_delta_t_valid("garbge"))