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