kopia lustrzana https://github.com/glidernet/python-ogn-client
LT24, Skylines: <id> --> <address>
rodzic
fabb92bc88
commit
cda1cb511b
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue