diff --git a/ogn/parser/pattern.py b/ogn/parser/pattern.py index 4a48674..49a9c6c 100644 --- a/ogn/parser/pattern.py +++ b/ogn/parser/pattern.py @@ -11,7 +11,7 @@ PATTERN_NAVITER_BEACON = re.compile(""" """, re.VERBOSE | re.MULTILINE) PATTERN_TRACKER_BEACON_POSITION = re.compile(""" - id(?P
\w{2})(?P\w{6}?)\s? + id(?P
[0-9A-F]{2})(?P[0-9A-F]{6}?)\s? (?:(?P[+-]\d+?)fpm\s)? (?:(?P[+-][\d.]+?)rot\s)? (?:FL(?P[\d.]+)\s)? @@ -114,7 +114,7 @@ PATTERN_RECEIVER_BEACON = re.compile(r""" PATTERN_AIRCRAFT_BEACON = re.compile(r""" - id(?P
\w{2})(?P\w{6}?)\s? + id(?P
[0-9A-F]{2})(?P[0-9A-F]{6}?)\s? (?:(?P[+-]\d+?)fpm\s)? (?:(?P[+-][\d.]+?)rot\s)? (?:FL(?P[\d.]+)\s)? diff --git a/tests/parser/test_parse.py b/tests/parser/test_parse.py index 1bff03c..986fca0 100644 --- a/tests/parser/test_parse.py +++ b/tests/parser/test_parse.py @@ -65,7 +65,7 @@ class TestStringMethods(unittest.TestCase): def test_fail_bad_dstcall(self): with self.assertRaises(OgnParseError): - parse("EPZR>WTFDSTCALL,TCPIP*,qAC,GLIDERN1:>093456h this is a comment") + parse("EPZR>WTFDSTCALL,TCPIP*,qAC,GLIDERN1:>093456h this is a comment", reference_date=datetime(2015, 1, 1)) def test_v026_chile(self): # receiver beacons from chile have a APRS position message with a pure user comment @@ -73,6 +73,10 @@ class TestStringMethods(unittest.TestCase): self.assertEqual(message['user_comment'], "Vitacura Municipal Aerodrome, Club de Planeadores Vitacura") + message_with_id = parse("ALFALFAL>APRS,TCPIP*,qAC,GLIDERN4:/221830h3330.40SI07007.88W&/A=008659 Alfalfal Hidroelectric Plant, Club de Planeadores Vitacurs", reference_date=datetime(2015, 1, 1)) + + self.assertEqual(message_with_id['user_comment'], "Alfalfal Hidroelectric Plant, Club de Planeadores Vitacurs") + @mock.patch('ogn.parser.parse_module.createTimestamp') def test_default_reference_date(self, createTimestamp_mock): valid_aprs_string = "Lachens>APRS,TCPIP*,qAC,GLIDERN2:/165334h4344.70NI00639.19E&/A=005435 v0.2.1 CPU:0.3 RAM:1764.4/2121.4MB NTP:2.8ms/+4.9ppm +47.0C RF:+0.70dB" diff --git a/tests/parser/valid_beacon_data/aprs_receiver.txt b/tests/parser/valid_beacon_data/aprs_receiver.txt index 0f724ca..043870e 100644 --- a/tests/parser/valid_beacon_data/aprs_receiver.txt +++ b/tests/parser/valid_beacon_data/aprs_receiver.txt @@ -25,3 +25,6 @@ VITACURA2>APRS,TCPIP*,qAC,GLIDERN3:>042136h v0.2.5.ARM CPU:0.3 RAM:695.0/970.5MB # since 0.2.6 the ogn comment of a receiver beacon is just optional, it also can be a user comment Ulrichamn>APRS,TCPIP*,qAC,GLIDERN1:/085616h5747.30NI01324.77E&/A=001322 ROBLE3>APRS,TCPIP*,qAC,GLIDERN4:/200022h3258.58SI07100.78W&/A=007229 Contact: achanes@manquehue.net, brito.felipe@gmail.com +# +# ... and user comment can include a 'id' +ALFALFAL>APRS,TCPIP*,qAC,GLIDERN4:/221830h3330.40SI07007.88W&/A=008659 Alfalfal Hidroelectric Plant, Club de Planeadores Vitacurs \ No newline at end of file