def test_decode_sea_level_pressure_less_49_point_9(self): # Edge case for SLP < 50 should have 1,000 hPa added val = "SLP499" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "sea level pressure is 1,049.9 hPa")
def test_decode_sea_level_pressure_is_50(self): # SLP >= 50 should have 900 hPa added val = "SLP500" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "sea level pressure is 950.0 hPa")
def test_decode_no_sea_level_pressure(self): val = "SLPNO" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "sea level pressure unavailable")
def test_decode_sea_level_pressure_is_garbage(self): val = "noSLPforyou" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "")
def test_decode_sea_level_pressure_less_than_50(self): val = "SLP196" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "sea level pressure is 1,019.6 hPa")
def test_decode_sea_level_pressure_greater_than_50(self): val = "SLP834" decoder = MetarDecoderDefault() decoder.decode_sea_level_pressure(val) res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY] assert_equals(res, "sea level pressure is 983.4 hPa")