コード例 #1
0
 def test_zero(self):
     result = ecu.get_hms(0)
     expected = '0:00'
     self.assertEqual(expected, result)
コード例 #2
0
 def test_negative(self):
     with self.assertRaises(ValueError) as cm:
         ecu.get_hms(-12)
     expected_message = 'received a negative or invalid value for seconds'
     exception_message = str(cm.exception)
     self.assertEqual(expected_message, exception_message)
コード例 #3
0
 def test_invalid_type(self):
     with self.assertRaises(TypeError) as cm:
         ecu.get_hms('using a string instead of a number')
     expected_message = 'seconds must be type int or float, received:'
     exception_message = str(cm.exception)[:44]
     self.assertEqual(expected_message, exception_message)
コード例 #4
0
 def test_3601(self):
     result = ecu.get_hms(3601)
     expected = '1:00:01'
     self.assertEqual(expected, result)
コード例 #5
0
 def test_float(self):
     expected = '12:12'
     result = ecu.get_hms(731.61)
     self.assertEqual(expected, result)
コード例 #6
0
 def test_3599(self):
     result = ecu.get_hms(3599)
     expected = '59:59'
     self.assertEqual(expected, result)
コード例 #7
0
 def test_61(self):
     result = ecu.get_hms(61)
     expected = '1:01'
     self.assertEqual(expected, result)
コード例 #8
0
 def test_60(self):
     result = ecu.get_hms(60)
     expected = '1:00'
     self.assertEqual(expected, result)
コード例 #9
0
 def test_59(self):
     result = ecu.get_hms(59)
     expected = '0:59'
     self.assertEqual(expected, result)
コード例 #10
0
 def test_one(self):
     result = ecu.get_hms(1)
     expected = '0:01'
     self.assertEqual(expected, result)