コード例 #1
0
 def test_get_charge_units(self):
     """Ensure that the get_charge_units function works as expected"""
     for usage_unit in ["kwh", "therms", "ccf", "hcf"]:
         charge = test_util.default_charge(UsageUnit=usage_unit)
         self.assertEqual(usage_unit, get_charge_units(charge))
     for demand_unit in ["kw"]:
         charge = test_util.default_charge(UsageUnit=demand_unit)
         self.assertEqual(demand_unit, get_charge_units(charge))
     for other_unit in ["", "test"]:
         charge = test_util.default_charge(UsageUnit=other_unit)
         self.assertEqual("other", get_charge_units(charge))
コード例 #2
0
 def test_nem_charges(self):
     """Test that the PG&E transformer can accurately detect NEM charges"""
     hits = ["Total NEM Charges Before Taxes", "total nem charges before taxes"]
     transformer = PacificGasElectricTransformer()
     for hit in hits:
         charge = test_util.default_charge(ChargeActualName=hit)
         self.assertTrue(transformer.is_nem_charge(charge))
コード例 #3
0
    def make_basic_dataset(self):
        """Helper function that creates a simple Urjanet dataset in memory"""
        account = test_util.default_account()
        meter = test_util.default_meter()
        for idx in range(1, 12):
            meter.charges.append(
                test_util.default_charge(IntervalStart=date(2000, idx, 1),
                                         IntervalEnd=date(2000, idx + 1, 1)))
        account.meters.append(meter)

        urja_data = urja_model.UrjanetData()
        urja_data.accounts.append(account)
        return urja_data
コード例 #4
0
    def test_adjustment_charges(self):
        """Test that the PG&E transformer can accurately detect correction charges"""
        hits = [
            "01/05/2017 - 02/03/2017 26,400.000000 kWh",
            "01/06/2017 - 02/03/2017 1,976.000000 Therms",
            "01/18/2018 - 02/15/2018 53,055.720000 kWh",
            "04/29/2015 - 04/30/2015 7,012.000000 kWh",
            "10/18/2018 - 11/18/2018 78,840.000000 kWh",
        ]
        transformer = PacificGasElectricTransformer()

        for hit in hits:
            charge = test_util.default_charge(ChargeActualName=hit)
            self.assertTrue(transformer.is_correction_charge(charge))