Example #1
0
    def test_a(self):
        """Test the aggregation of a single daily event to an average monthly
        event.

        """
        timeserie = TimeseriesStub()
        timeserie.add_value(datetime(2010, 12, 8), 20)
        avg_monthly_events = [e for e in average_monthly_events(timeserie)]
        expected_avg_monthly_events = [(datetime(2010, 12, 1), 20.0)]
        self.assertEqual(expected_avg_monthly_events, avg_monthly_events)
Example #2
0
    def test_a(self):
        """Test the aggregation of a single daily event to an average monthly
        event.

        """
        timeserie = TimeseriesStub()
        timeserie.add_value(datetime(2010, 12, 8), 20)
        avg_monthly_events = [e for e in average_monthly_events(timeserie)]
        expected_avg_monthly_events = [(datetime(2010, 12, 1), 20.0)]
        self.assertEqual(expected_avg_monthly_events, avg_monthly_events)
Example #3
0
    def test_b(self):
        """Test the aggregation of multiple daily events to an average monthly
        event.

        The daily events lie within a single month.

        """
        timeserie = TimeseriesStub()
        timeserie.add_value(datetime(2010, 12, 8), 20)
        timeserie.add_value(datetime(2010, 12, 9), 30)
        timeserie.add_value(datetime(2010, 12, 10), 40)
        avg_monthly_events = [e for e in average_monthly_events(timeserie)]
        expected_avg_monthly_events = [(datetime(2010, 12, 1), 30.0)]
        self.assertEqual(expected_avg_monthly_events, avg_monthly_events)
Example #4
0
    def test_b(self):
        """Test the aggregation of multiple daily events to an average monthly
        event.

        The daily events lie within a single month.

        """
        timeserie = TimeseriesStub()
        timeserie.add_value(datetime(2010, 12, 8), 20)
        timeserie.add_value(datetime(2010, 12, 9), 30)
        timeserie.add_value(datetime(2010, 12, 10), 40)
        avg_monthly_events = [e for e in average_monthly_events(timeserie)]
        expected_avg_monthly_events = [(datetime(2010, 12, 1), 30.0)]
        self.assertEqual(expected_avg_monthly_events, avg_monthly_events)