Exemplo n.º 1
0
 def test_average_invalid_values(self):
     processor = Processor(self.db)
     result = processor.find_average(None, 360)
     self.assertIsNone(result)
     result = processor.find_average(1999, None)
     self.assertIsNone(result)
     result = processor.find_average(None, None)
     self.assertIsNone(result)
     result = processor.find_average(1978, 400)
     self.assertIsNone(result)
Exemplo n.º 2
0
 def test_average_temp(self):
     processor = Processor(self.db)
     result = processor.find_average(1999, 360)
     self.assertEqual(result, -45)
     result = processor.find_average(1999, 30)
     self.assertEqual(result, 22)
     result = processor.find_average(1999, 1)
     self.assertEqual(result, 7.4)
     result = processor.find_average(2000, 365)
     self.assertEqual(result, 12)
Exemplo n.º 3
0
 def _get_averages(self, year, start, end):
     processor = Processor(self.db)
     return [processor.find_average(year, x) for x in range(start, end)]