Skip to content

Commit

Permalink
Remove trailing comma from QuerySentence identifier. Fixes #120
Browse files Browse the repository at this point in the history
  • Loading branch information
Knio committed Feb 20, 2021
1 parent 4527cf4 commit 3ab8516
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pynmea2/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.15.0'
__version__ = '1.16.0'
2 changes: 1 addition & 1 deletion pynmea2/nmea.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def __init__(self, talker, listener, sentence_type):
self.data = []

def identifier(self):
return '%s%sQ,%s,' % (self.talker, self.listener, self.sentence_type)
return '%s%sQ,%s' % (self.talker, self.listener, self.sentence_type)


class ProprietarySentence(NMEASentence):
Expand Down
7 changes: 6 additions & 1 deletion test/test_pynmea.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test_version():
version = '1.15.0'
version = '1.16.0'
assert pynmea2.version == version
assert pynmea2.__version__ == version

Expand Down Expand Up @@ -87,19 +87,24 @@ def test_nmea_util():
assert pynmea2.nmea_utils.dm_to_sd('0') == 0.
assert pynmea2.nmea_utils.dm_to_sd('12108.1') == 121.135


def test_missing_latlon():
data = '$GPGGA,201716.684,,,,,0,00,,,M,0.0,M,,0000*5F'
msg = pynmea2.parse(data)
print(msg)
assert msg.latitude == 0.


def test_query():
data = 'CCGPQ,GGA'
msg = pynmea2.parse(data)
assert isinstance(msg, pynmea2.QuerySentence)
assert msg.talker == 'CC'
assert msg.listener == 'GP'
assert msg.sentence_type == 'GGA'
msg = pynmea2.QuerySentence('CC', 'GP', 'GGA')
assert msg.render() == '$CCGPQ,GGA*2B'


def test_slash():
with pytest.raises(pynmea2.nmea.ParseError):
Expand Down

0 comments on commit 3ab8516

Please sign in to comment.