Пример #1
0
 def test_ea(self):
     """Test the value before the third date & time is the second value."""
     today = datetime(2010, 12, 20)
     timeserie = TimeseriesStub((today, 10.0),
                                (today + timedelta(1), 20.0),
                                (today + timedelta(2), 30.0))
     self.assertAlmostEqual(20.0, timeserie.get_value(today + timedelta(1)))
Пример #2
0
 def test_d(self):
     """Test the value after the first date & time is zero."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     tomorrow = today + timedelta(1)
     self.assertAlmostEqual(0.0, timeserie.get_value(tomorrow))
Пример #3
0
 def test_d(self):
     """Test the value after the first date & time is zero."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     tomorrow = today + timedelta(1)
     self.assertAlmostEqual(0.0, timeserie.get_value(tomorrow))
Пример #4
0
 def test_e(self):
     """Test the value before the second date & time is zero."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     tomorrow = today + timedelta(1)
     day_after_tomorrow = tomorrow + timedelta(1)
     timeserie.add_value(day_after_tomorrow, 30.0)
     self.assertAlmostEqual(0.0, timeserie.get_value(tomorrow))
Пример #5
0
 def test_e(self):
     """Test the value before the second date & time is zero."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     tomorrow = today + timedelta(1)
     day_after_tomorrow = tomorrow + timedelta(1)
     timeserie.add_value(day_after_tomorrow, 30.0)
     self.assertAlmostEqual(0.0, timeserie.get_value(tomorrow))
Пример #6
0
 def test_c(self):
     """Test the value on the first date & time is the first value."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     self.assertAlmostEqual(20.0, timeserie.get_value(today))
Пример #7
0
 def test_ea(self):
     """Test the value before the third date & time is the second value."""
     today = datetime(2010, 12, 20)
     timeserie = TimeseriesStub((today, 10.0), (today + timedelta(1), 20.0),
                                (today + timedelta(2), 30.0))
     self.assertAlmostEqual(20.0, timeserie.get_value(today + timedelta(1)))
Пример #8
0
 def test_c(self):
     """Test the value on the first date & time is the first value."""
     timeserie = TimeseriesStub()
     today = datetime(2010, 11, 24)
     timeserie.add_value(today, 20.0)
     self.assertAlmostEqual(20.0, timeserie.get_value(today))