Beispiel #1
0
    def test_single_packet_file_like(self):
        bytes_io = BytesIO(
            bytes.fromhex(
                "FA FF 36 53 10 20 02 89 90 10 60 04 00 26 C7 33 40 20 0C 3D 0A 5D 4A BD 28 44 1C 41 1D "
                "09 AF 40 10 0C 38 B0 80 00 B8 D7 28 00 3C C9 02 28 80 20 0C BA E5 4C 02 BB 9A 3F 83 BA "
                "D8 04 03 80 30 10 3F 80 00 01 B6 12 C0 01 B6 C5 70 00 B6 0A 40 00 E0 20 04 00 00 00 05 "
                "F4"))

        xp = XSensParser(bytes_io)
        xp.start()

        packet = xp.get()
        errors = object_hierarchy_equals(packet, self.correct_single_packet)
        # print("\n".join(errors))
        self.assertEqual(len(errors), 0)
Beispiel #2
0
    def test_file(self):
        with open(test_dir_path / "data_files" / "xsens_raw_data.bin",
                  "rb") as f:
            xp = XSensParser(f)
            xp.start()

            tables = xp.get_tables()

            # Uncomment this line to update the tables in the data file.
            # File(test_dir_path / "data_files" / "correct_xsens_tables.msgp.gz").dump(tables)

            correct_tables = flex_load(test_dir_path / "data_files" /
                                       "correct_xsens_tables.msgp.gz")

            errors = object_hierarchy_equals(tables, correct_tables)
            # print("\n".join(errors))
            self.assertEqual(len(errors), 0)