def test_parse_winds_variable(self): parser = MetarParserDefault() tokens = '18015KT 150V210 10SM'.split() # Make sure both the wind info and direction variation get picked up res = parser.parse_wind_dir_speed(tokens) res = parser.parse_wind_dir_variation(res) assert_equals(parser.parsed_metar["wind_dir_speed"], '18015KT') assert_equals(parser.parsed_metar["wind_dir_variation"], '150V210')
def test_parse_winds_variable_missing(self): ### If the variable winds section is missing we shouldn't set the ### MetarParser's wind_dir_variation field, or strip anything parser = MetarParserDefault() tokens = '18015KT 10SM'.split() # Include the wind_dir_speed parseor for a sanity check res = parser.parse_wind_dir_speed(tokens) res = parser.parse_wind_dir_variation(res) assert_equals(parser.parsed_metar["wind_dir_speed"], '18015KT') assert_equals(parser.parsed_metar["wind_dir_variation"], '') assert_equals(res, ['10SM'])