def test_supported_sentence_types(self) -> None:
        """Tests if supported sentence types are indeed supported, and if other types raise.

        It is important to notice that GNS sentence type is not supported by the nmeasim library, and thus we currently
        don't test it here.
        """
        for sentence in self.supported_nmea_sentences:
            parse_mavlink_from_sentence(sentence)

        for sentence in self.unsupported_nmea_sentences:
            # NMEA-Injector does not support ZDA sentence type, thus it will raise
            with pytest.raises(UnsupportedSentenceType):
                parse_mavlink_from_sentence(sentence)
 def test_lat_lon(self) -> None:
     """Tests if latitude and longitude values parsed to Mavlink package are the correct ones."""
     for sentence in self.supported_nmea_sentences:
         mavlink_data = parse_mavlink_from_sentence(sentence)
         # Mavlink GPS input uses "degE7" unit, thus we need to transform the original degree value to do the check
         assert mavlink_data.lat == pytest.approx(self.LAT_FD * 1e7)
         assert mavlink_data.lon == pytest.approx(self.LON_FD * 1e7)
 def test_alt(self) -> None:
     """Tests if 'alt' field is working correctly for all sentence types that support it."""
     types_support_alt = ["GGA"]
     for sentence in [
             msg for msg in self.supported_nmea_sentences
             if msg.sentence_type in types_support_alt
     ]:
         mavlink_data = parse_mavlink_from_sentence(sentence)
         assert mavlink_data.alt == self.ALTITUDE
 def test_num_sats(self) -> None:
     """Tests if 'satellites_visible' field is working correctly for all sentence types that support it."""
     types_support_sats = ["GGA", "GNS"]
     for sentence in [
             msg for msg in self.supported_nmea_sentences
             if msg.sentence_type in types_support_sats
     ]:
         mavlink_data = parse_mavlink_from_sentence(sentence)
         assert mavlink_data.satellites_visible == self.NUM_SATS
 def test_hdop(self) -> None:
     """Tests if 'hdop' field is working correctly for all sentence types that support it."""
     types_support_hdop = ["GGA", "GNS"]
     for sentence in [
             msg for msg in self.supported_nmea_sentences
             if msg.sentence_type in types_support_hdop
     ]:
         mavlink_data = parse_mavlink_from_sentence(sentence)
         assert mavlink_data.hdop == self.HDOP
 def parse_mavlink_package(nmea_msg: str) -> MavlinkGpsInput:
     """Transform NMEA message into proper Mavlink GPS_INPUT package."""
     nmea_sentence = pynmea2.parse(nmea_msg)
     return parse_mavlink_from_sentence(nmea_sentence)