def test_aa(self):
     """Test the case with timeseries that have different times."""
     today = datetime(2011, 11, 3, 0, 0)
     later_today = datetime(2011, 11, 3, 9, 0)
     timeseries = [TimeseriesStub((today, 2)),
                   TimeseriesStub((later_today, 4))]
     events = [event for event in enumerate_events(*timeseries)]
     self.assertEqual([((today, 2), (later_today, 4))], events)
    def test_c(self):
        """Test the case that the time series contains an empty time series"""
        today = datetime(2010, 12, 2)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        evaporation = TimeseriesStub()
        events = [e for e in enumerate_events(precipitation, evaporation)]

        expected_events = [((today, 5), (today, 0))]
        self.assertEqual(expected_events[0], events[0])
Exemple #3
0
    def test_c(self):
        """Test the case that the time series contains an empty time series"""
        today = datetime(2010, 12, 2)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        evaporation = TimeseriesStub()
        events = [e for e in enumerate_events(precipitation, evaporation)]

        expected_events = [((today, 5), (today, 0))]
        self.assertEqual(expected_events[0], events[0])
Exemple #4
0
 def test_aa(self):
     """Test the case with timeseries that have different times."""
     today = datetime(2011, 11, 3, 0, 0)
     later_today = datetime(2011, 11, 3, 9, 0)
     timeseries = [
         TimeseriesStub((today, 2)),
         TimeseriesStub((later_today, 4))
     ]
     events = [event for event in enumerate_events(*timeseries)]
     self.assertEqual([((today, 2), (later_today, 4))], events)
    def test_b(self):
        """Test the case that the time series contain different dates"""
        today = datetime(2010, 12, 2)
        tomorrow = datetime(2010, 12, 3)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        evaporation = TimeseriesStub()
        evaporation.add_value(today, 10)
        evaporation.add_value(tomorrow, 30)
        events = [e for e in enumerate_events(precipitation, evaporation)]

        expected_events = [((today, 5), (today, 10)),
                           ((tomorrow, 0), (tomorrow, 30))]
        self.assertEqual(expected_events[0], events[0])
        self.assertEqual(expected_events[1], events[1])
Exemple #6
0
    def test_b(self):
        """Test the case that the time series contain different dates"""
        today = datetime(2010, 12, 2)
        tomorrow = datetime(2010, 12, 3)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        evaporation = TimeseriesStub()
        evaporation.add_value(today, 10)
        evaporation.add_value(tomorrow, 30)
        events = [e for e in enumerate_events(precipitation, evaporation)]

        expected_events = [((today, 5), (today, 10)),
                           ((tomorrow, 0), (tomorrow, 30))]
        self.assertEqual(expected_events[0], events[0])
        self.assertEqual(expected_events[1], events[1])
    def test_a(self):
        today = datetime(2010, 12, 2)
        tomorrow = datetime(2010, 12, 3)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        precipitation.add_value(tomorrow, 10)
        evaporation = TimeseriesStub()
        evaporation.add_value(today, 20)
        evaporation.add_value(tomorrow, 30)
        seepage = TimeseriesStub()
        seepage.add_value(today, 10)
        seepage.add_value(tomorrow, 20)
        events = [e for e in enumerate_events(precipitation,
                                              evaporation,
                                              seepage)]

        expected_events = [((today, 5), (today, 20), (today, 10)),
                           ((tomorrow, 10), (tomorrow, 30), (tomorrow, 20))]
        self.assertEqual(expected_events, events)
Exemple #8
0
    def test_a(self):
        today = datetime(2010, 12, 2)
        tomorrow = datetime(2010, 12, 3)
        precipitation = TimeseriesStub()
        precipitation.add_value(today, 5)
        precipitation.add_value(tomorrow, 10)
        evaporation = TimeseriesStub()
        evaporation.add_value(today, 20)
        evaporation.add_value(tomorrow, 30)
        seepage = TimeseriesStub()
        seepage.add_value(today, 10)
        seepage.add_value(tomorrow, 20)
        events = [
            e for e in enumerate_events(precipitation, evaporation, seepage)
        ]

        expected_events = [((today, 5), (today, 20), (today, 10)),
                           ((tomorrow, 10), (tomorrow, 30), (tomorrow, 20))]
        self.assertEqual(expected_events, events)
    def test_e(self):
        """Test enumerate_events returns an empty list with an empty time
        series.

        """
        self.assertEqual([], list(enumerate_events(TimeseriesStub())))
Exemple #10
0
    def test_e(self):
        """Test enumerate_events returns an empty list with an empty time
        series.

        """
        self.assertEqual([], list(enumerate_events(TimeseriesStub())))