def get_metar(args): if len(args['metar']) == 4: raw_metar = metar_sources.download(args['metar']) else: raw_metar = args['metar'] return parse(raw_metar)
def test_p(self, string): test = parse(string) if test.reporttype != 'NIL': self.assertEqual(test.report.pressure, 1013) else: self.assertIs(test.report, None) self.assertEqual(test.unmatched, '')
def test_transitionlevel(self, metar, expected): metar = parse(metar) self.assertEqual( transition_level(self.airport, self.transition, metar), expected)
def test_intro(self, metar, expected): metar = parse(metar) self.assertEqual(intro(self.letter, metar), expected)
def test_qnh(self, metar, expected): metar = parse(metar) self.assertEqual(qnh(metar), expected)
def test_dewpoint(self, metar, expected): metar = parse(metar) self.assertEqual(dewpoint(metar), expected)
def test_temperature(self, metar, expected): metar = parse(metar) self.assertEqual(temperature(metar), expected)
def test_sky_gndlevel(self, metar, expected): metar = parse(metar) self.assertEqual(sky(metar), expected, 'see: issue#15')
def test_sky(self, metar, expected): metar = parse(metar) self.assertEqual(sky(metar), expected)
def test_recentWeather(self, metar, expected): metar = parse(metar) self.assertEqual(precip(metar), expected, 'issue #TODO')
def test_clouds(self, metar, expected): metar = parse(metar) self.assertEqual(clouds(metar), expected)
def test_weather(self, metar, expected): metar = parse(metar) self.assertEqual(weather(metar), expected)
def test_rvr(self, metar, expected): metar = parse(metar) self.assertEqual(rvr(metar), expected)
def test_vis(self, metar, expected): metar = parse(metar) self.assertEqual(vis(metar), expected)
def test_wind(self, metar, expected): metar = parse(metar) self.assertEqual(wind(metar), expected)
def test_p_attributeerror_vis(self, string, errorexp): with self.assertRaisesRegexp(ValueError, errorexp): parse(string)