Exemple #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))
Exemple #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()))
Exemple #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()))
Exemple #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())
Exemple #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()))
Exemple #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()))
Exemple #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))