test_nmea module

Tests for Nmea data parser.

test_nmea.compare_nmea_values(nmea_instance, row_name, exp_value, eq_decimal)[source]

Helper funtion for comparing NMEA objects.

nmea_instancegnss_lib_py.parsers.nmea.Nmea

Nmea instance to check.

row_namestring

Row name to check against

exp_valuestr, float, or int

Expected value of element.

eq_decimalint

Decimal passed into assert_almost_equal after which isn’t checked for equivalency.

test_nmea.fixture_nmea_file_no_checksum(root_path)[source]

Location of NMEA file without checksum values.

The checksum values are at the end of each NMEA sentence (after an *). This instance of the NMEA file has no checksums at the end.

Parameters:

root_path (string) – Folder location containing all NMEA files for unit tests.

Returns:

nmea_no_checksum – Location of NMEA file with correct checksums

Return type:

string

test_nmea.fixture_nmea_file_w_correct_checksum(root_path)[source]

Location of NMEA file with correct checksum values.

The checksum values are at the end of each NMEA sentence. This instance of the NMEA file has the correct checksums at the end.

Parameters:

root_path (string) – Folder location containing all NMEA files for unit tests.

Returns:

nmea_checksum – Location of NMEA file with correct checksums

Return type:

string

test_nmea.fixture_nmea_file_w_wrong_checksum(root_path)[source]

Location of NMEA file with wrong checksum values.

The checksum values are at the end of each NMEA sentence. This instance of the NMEA file has the wrong checksums at the end for the RMC sentences.

Parameters:

root_path (string) – Folder location containing all NMEA files for unit tests.

Returns:

nmea_wrong_checksum – Location of NMEA file with wrong checksums

Return type:

string

test_nmea.test_failing_checksum(nmea_wrong_checksum)[source]

Test behaviour when wrong checksums exist and check=True.

Parameters:

nmea_wrong_checksum (str) – Path to NMEA file with incorrect checksums at the end of the RMC statements. These

test_nmea.test_nmea_loading(nmea_file, check, row_name, exp_value, eq_decimal)[source]

Test that the NMEA files are being loaded without any errors.

Also compares some fixed values to the loaded values to ensure that values are not changed when theyu’re loaded

Parameters:
  • nmea_file (string) – Location of the NMEA file to be loaded

  • check (bool) – True if the checksum at the end of the NMEA sentence should be ignored. False if the checksum should be checked and lines with incorrect checksums will be ignored.

  • row_name (string) – Row name to check against

  • exp_value (str, float, or int) – Expected value of element.

  • eq_decimal (int) – Decimal passed into assert_almost_equal after which isn’t checked for equivalency.