LT24, Skylines: <id> --> <address>

pull/62/head
Konstantin Gründger 2018-04-28 21:31:50 +02:00
rodzic fabb92bc88
commit cda1cb511b
4 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -13,6 +13,6 @@ class LT24Parser(BaseParser):
@staticmethod
def parse_position(aprs_comment):
ac_match = re.search(PATTERN_LT24_POSITION_COMMENT, aprs_comment)
return {'id': ac_match.group('id'),
return {'address': ac_match.group('id'),
'climb_rate': int(ac_match.group('climb_rate')) * fpm2ms if ac_match.group('climb_rate') else None,
'source': ac_match.group('source') if ac_match.group('source') else None}

Wyświetl plik

@ -13,5 +13,5 @@ class SkylinesParser(BaseParser):
@staticmethod
def parse_position(aprs_comment):
ac_match = re.search(PATTERN_SKYLINES_POSITION_COMMENT, aprs_comment)
return {'id': ac_match.group('id'),
return {'address': ac_match.group('id'),
'climb_rate': int(ac_match.group('climb_rate')) * fpm2ms if ac_match.group('climb_rate') else None}

Wyświetl plik

@ -8,7 +8,7 @@ class TestStringMethods(unittest.TestCase):
def test_position_comment(self):
message = LT24Parser.parse_position("id25387 +000fpm GPS")
self.assertEqual(message['id'], "25387")
self.assertEqual(message['address'], "25387")
self.assertAlmostEqual(message['climb_rate'] * ms2fpm, 0, 2)
self.assertEqual(message['source'], 'GPS')

Wyświetl plik

@ -8,7 +8,7 @@ class TestStringMethods(unittest.TestCase):
def test_position_comment(self):
message = SkylinesParser.parse_position("id2816 -015fpm")
self.assertEqual(message['id'], "2816")
self.assertEqual(message['address'], "2816")
self.assertAlmostEqual(message['climb_rate'] * ms2fpm, -15, 2)