Exemplo n.º 1
0
    def test_cost(self):
        l_data      = [(1379487600, 5.0), (1379488500, 5.0), (1379489400, 5.0), (1379490300, 5.0), (1379491200, 5.0)]
        cost        = [(1379487600, 0.0), (1379488500, 0.17), (1379489400, 0.17), (1379490300, 0.17), (1379491200, 0.17)]
        cumulative_cost = [(1379487600, 0.0), (1379488500, 0.17), (1379489400, 0.34), (1379490300, 0.52), (1379491200, 0.69)]

        tariff = Tariff(tariff_file=self.get_test_tariff(), timezone='America/Los_Angeles')
        ls = Loadshape(l_data, timezone='America/Los_Angeles', log_level=30, tariff=tariff)
        cost_out, cumulative_cost_out = ls.cost()

        assert cost_out.data() == cost
        assert cumulative_cost_out.data() == cumulative_cost
Exemplo n.º 2
0
    def test_cost(self):
        l_data = [(1379487600, 5.0), (1379488500, 5.0), (1379489400, 5.0),
                  (1379490300, 5.0), (1379491200, 5.0)]
        cost = [(1379487600, 0.0), (1379488500, 0.17), (1379489400, 0.17),
                (1379490300, 0.17), (1379491200, 0.17)]
        cumulative_cost = [(1379487600, 0.0), (1379488500, 0.17),
                           (1379489400, 0.34), (1379490300, 0.52),
                           (1379491200, 0.69)]

        tariff = Tariff(tariff_file=self.get_test_tariff(),
                        timezone='America/Los_Angeles')
        ls = Loadshape(l_data,
                       timezone='America/Los_Angeles',
                       log_level=30,
                       tariff=tariff)
        cost_out, cumulative_cost_out = ls.cost()

        assert cost_out.data() == cost
        assert cumulative_cost_out.data() == cumulative_cost