예제 #1
0
 def test_insert_case_out_of_range(self):
     t_tr = temp_tracker.TempTracker()
     with self.assertRaises(ValueError) as context:
         t_tr.insert(-2)
     self.assertTrue('out of range, input should be between ' +
                     str(t_tr.min_temp) + ' and ' +
                     str(t_tr.max_temp) in str(context.exception))
예제 #2
0
 def test_get_max(self):
     t_tr = temp_tracker.TempTracker()
     t_tr.insert(99)
     t_tr.insert(2)
     self.assertEqual(50.5, t_tr.get_mean())
     self.assertEqual(float, type(t_tr.get_mean()))
예제 #3
0
 def test_get_mean_without_values(self):
     t_tr = temp_tracker.TempTracker()
     self.assertEqual(0.0, t_tr.get_mean())
     self.assertEqual(float, type(t_tr.get_mean()))
예제 #4
0
 def test_insert_case_good_input(self):
     t_tr = temp_tracker.TempTracker()
     t_tr.insert(99)
     self.assertEqual(99, t_tr.get_min())
예제 #5
0
 def test_get_max(self):
     t_tr = temp_tracker.TempTracker()
     t_tr.insert(99)
     t_tr.insert(2)
     self.assertEqual(99, t_tr.get_max())
     self.assertEqual(int, type(t_tr.get_max()))
예제 #6
0
 def test_get_max_without_values(self):
     t_tr = temp_tracker.TempTracker()
     self.assertEqual(0, t_tr.get_max())
     self.assertEqual(int, type(t_tr.get_max()))
예제 #7
0
 def test_insert_case_wrong_input(self):
     t_tr = temp_tracker.TempTracker()
     with self.assertRaises(ValueError) as context:
         t_tr.insert('toto')
     self.assertTrue('input should be an integer' in str(context.exception))