def test_recent_reading_meter():
    recent_record = {"start": datetime.now(pytz.utc) - timedelta(days=390),
            "end": datetime.now(pytz.utc) - timedelta(days=360), "value": 0}
    old_record = {"start": datetime(2012,1,1,tzinfo=pytz.utc),
            "end": datetime(2012,2,1,tzinfo=pytz.utc), "value": 0}

    no_cd = ConsumptionData([],
            "electricity", "kWh", record_type="arbitrary")
    old_cd = ConsumptionData([old_record],
            "electricity", "kWh", record_type="arbitrary")
    recent_cd = ConsumptionData([recent_record],
            "electricity", "kWh", record_type="arbitrary")
    mixed_cd = ConsumptionData([recent_record,old_record],
            "electricity", "kWh", record_type="arbitrary")

    meter = RecentReadingMeter()
    assert meter.evaluate_raw(consumption_data=no_cd)["n_days"] == np.inf
    assert meter.evaluate_raw(consumption_data=old_cd)["n_days"] == 31
    assert meter.evaluate_raw(consumption_data=recent_cd)["n_days"] == 30
    assert meter.evaluate_raw(consumption_data=mixed_cd)["n_days"] == 30
dataset/ETHPy150Open impactlab/eemeter/tests/test_meter_library.py/test_recent_reading_meter/original