Skip to content

Commit

Permalink
SorTask903 Unit test convert_seconds_to_pandas_minutes() (#907)
Browse files Browse the repository at this point in the history
* Added unit test for function convert_seconds_to_minutes

* Nits
  • Loading branch information
neha2801-create authored May 6, 2024
1 parent 9d9df5e commit a7952ef
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions helpers/test/test_hdatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# #############################################################################
Expand Down

0 comments on commit a7952ef

Please sign in to comment.