kopia lustrzana https://github.com/glidernet/python-ogn-client
Changed spider/spot <id> to <address>
rodzic
8c874a3226
commit
fabb92bc88
|
@ -12,7 +12,7 @@ class SpiderParser(BaseParser):
|
|||
@staticmethod
|
||||
def parse_position(aprs_comment):
|
||||
ac_match = re.search(PATTERN_SPIDER_POSITION_COMMENT, aprs_comment)
|
||||
return {'id': ac_match.group('id'),
|
||||
return {'address': ac_match.group('id'),
|
||||
'signal_power': int(ac_match.group('signal_power')) if ac_match.group('signal_power') else None,
|
||||
'spider_id': ac_match.group('spider_id') if ac_match.group('spider_id') else None,
|
||||
'gps_quality': ac_match.group('gps_quality') if ac_match.group('gps_quality') else None}
|
||||
|
|
|
@ -12,6 +12,6 @@ class SpotParser(BaseParser):
|
|||
@staticmethod
|
||||
def parse_position(aprs_comment):
|
||||
ac_match = re.search(PATTERN_SPOT_POSITION_COMMENT, aprs_comment)
|
||||
return {'id': ac_match.group('id'),
|
||||
return {'address': ac_match.group('id'),
|
||||
'model': int(ac_match.group('model')) if ac_match.group('model') else None,
|
||||
'status': ac_match.group('status') if ac_match.group('status') else None}
|
||||
|
|
|
@ -7,7 +7,7 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = SpiderParser.parse_position("id300234010617040 +19dB LWE 3D")
|
||||
|
||||
self.assertEqual(message['id'], "300234010617040")
|
||||
self.assertEqual(message['address'], "300234010617040")
|
||||
self.assertEqual(message['signal_power'], 19)
|
||||
self.assertEqual(message['spider_id'], "LWE")
|
||||
self.assertEqual(message['gps_quality'], "3D")
|
||||
|
|
|
@ -7,7 +7,7 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = SpotParser.parse_position("id0-2860357 SPOT3 GOOD")
|
||||
|
||||
self.assertEqual(message['id'], "0-2860357")
|
||||
self.assertEqual(message['address'], "0-2860357")
|
||||
self.assertEqual(message['model'], 3)
|
||||
self.assertEqual(message['status'], "GOOD")
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue