def test_pressure_observations_parser_approximates_pressure_msl(data_dir):
    p = PressureObservationsParser(path=data_dir /
                                   'observations_recent_P0_hist.zip')
    records = list(p.parse())
    # The actual reduced pressure deleted from the test observation file was
    # 1023.0 hPa
    assert records[4]['pressure_msl'] == 102260
def test_observations_parser_skips_file_if_out_of_range(data_dir):
    p = PressureObservationsParser(path=data_dir /
                                   'observations_19950901_20150817_hist.zip')
    assert not p.should_skip()
    with settings(MIN_DATE=datetime.datetime(2016, 1, 1, tzinfo=tzutc()), ):
        assert p.should_skip()
    with settings(MAX_DATE=datetime.datetime(1995, 1, 1, tzinfo=tzutc()), ):
        assert p.should_skip()
def test_observations_parser_parses_historical_observation_type(data_dir):
    p = PressureObservationsParser(path=data_dir /
                                   'observations_recent_P0_hist.zip')
    for record in p.parse():
        assert record['observation_type'] == 'historical'