diff --git a/helpers/test/test_hdatetime.py b/helpers/test/test_hdatetime.py index 0f7837afa6..3754fa8a9c 100644 --- a/helpers/test/test_hdatetime.py +++ b/helpers/test/test_hdatetime.py @@ -576,6 +576,40 @@ def test3(self) -> None: self.assert_equal(str(act), str(exp)) +# ############################################################################# +# Test_convert_seconds_to_minutes +# ############################################################################# + + +class Test_convert_seconds_to_minutes(hunitest.TestCase): + def test1(self) -> None: + """ + Check that conversion is implemented correcty. + """ + num_secs = 300 + act = hdateti.convert_seconds_to_minutes(num_secs) + exp = int(num_secs / 60) + self.assertEqual(act, exp) + + def test2(self) -> None: + """ + Check that an error is raised when input is not an integer number of + minutes. + """ + num_secs = 10 + with self.assertRaises(AssertionError) as cm: + hdateti.convert_seconds_to_minutes(num_secs) + act = str(cm.exception) + exp = """ + * Failed assertion * + '10' + == + '0' + num_secs=10 is not an integer number of minutes + """ + self.assert_equal(act, exp, fuzzy_match=True) + + # ############################################################################# # Test_convert_unix_epoch_to_timestamp # #############################################################################