File: test_utils.py

package info (click to toggle)
python-nmea2 1.19.0-3
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 420 kB
  • sloc: python: 2,948; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pytest
import pynmea2
import pynmea2.nmea_utils


def test_GGA():
    data = "$GPGGA,184353.07,1929.045,S,02410.506,E,1,04,2.6,100.00,M,-33.9,M,,0000*6D"
    msg = pynmea2.parse(data)
    assert msg.latitude == -19.484083333333334
    assert msg.longitude == 24.1751
    assert msg.is_valid == True

def test_latlon():
    data = "$GPGGA,161405.680,37.352387,N,121.953086,W,1,10,0.01,-110.342552,M,0.000000,M,,0000,*4E"
    msg = pynmea2.parse(data)
    with pytest.raises(ValueError):
        x =  msg.latitude