Esempio n. 1
0
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)
Esempio n. 2
0
    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, '')
Esempio n. 3
0
 def test_transitionlevel(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(
         transition_level(self.airport, self.transition, metar), expected)
Esempio n. 4
0
 def test_intro(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(intro(self.letter, metar), expected)
Esempio n. 5
0
 def test_qnh(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(qnh(metar), expected)
Esempio n. 6
0
 def test_dewpoint(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(dewpoint(metar), expected)
Esempio n. 7
0
 def test_temperature(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(temperature(metar), expected)
Esempio n. 8
0
 def test_sky_gndlevel(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(sky(metar), expected, 'see: issue#15')
Esempio n. 9
0
 def test_sky(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(sky(metar), expected)
Esempio n. 10
0
 def test_recentWeather(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(precip(metar), expected, 'issue #TODO')
Esempio n. 11
0
 def test_clouds(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(clouds(metar), expected)
Esempio n. 12
0
 def test_weather(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(weather(metar), expected)
Esempio n. 13
0
 def test_rvr(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(rvr(metar), expected)
Esempio n. 14
0
 def test_vis(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(vis(metar), expected)
Esempio n. 15
0
 def test_wind(self, metar, expected):
     metar = parse(metar)
     self.assertEqual(wind(metar), expected)
Esempio n. 16
0
 def test_p_attributeerror_vis(self, string, errorexp):
     with self.assertRaisesRegexp(ValueError, errorexp):
         parse(string)