From bfd6a16a1f8c15b037b6d6208cde0c6f437db1e8 Mon Sep 17 00:00:00 2001 From: "Dr. Tilmann Bubeck" Date: Tue, 10 Sep 2024 20:41:27 +0200 Subject: [PATCH] igc/reader: fix for HFTZN to handle timezone that is not integer (#306) --- CHANGELOG.rst | 4 ++++ aerofiles/igc/reader.py | 2 +- tests/igc/test_reader.py | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bc80854..d76bdb8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,10 @@ Changelog Here you can see the full list of changes between each aerofiles release. +aerofiles vXXX, 2024-XX-YYYY +---------------------------- +- igc/reader: fix for HFTZN to handle timezone that is not integer + aerofiles v1.3.1, 2024-08-12 ---------------------------- - messed up v1.3.0 deployment. Redeploy as v1.3.1 without any changes. diff --git a/aerofiles/igc/reader.py b/aerofiles/igc/reader.py index 0d40adc..e4969d7 100644 --- a/aerofiles/igc/reader.py +++ b/aerofiles/igc/reader.py @@ -578,7 +578,7 @@ def decode_H_competition_class(value): @staticmethod def decode_H_time_zone_offset(value): - return {'time_zone_offset': int(float(value))} + return {'time_zone_offset': float(value)} @staticmethod def decode_H_mop_sensor(value): diff --git a/tests/igc/test_reader.py b/tests/igc/test_reader.py index be4f5fc..ec13769 100644 --- a/tests/igc/test_reader.py +++ b/tests/igc/test_reader.py @@ -518,6 +518,26 @@ def test_decode_H_time_zone_offset2(): assert LowLevelReader.decode_H_record(line) == expected_result +def test_decode_H_time_zone_offset3(): + line = 'HFTZNTIMEZONE:4.5\r\n' + expected_result = { + 'source': 'F', + 'time_zone_offset': 4.5 + } + + assert LowLevelReader.decode_H_record(line) == expected_result + + +def test_decode_H_time_zone_offset4(): + line = 'HFTZNTIMEZONE:-4.5\r\n' + expected_result = { + 'source': 'F', + 'time_zone_offset': -4.5 + } + + assert LowLevelReader.decode_H_record(line) == expected_result + + def test_decode_H_mop_sensor(): line = 'HFMOPSENSOR:MOP-(SN:1,ET=1375,0,1375,0,3.05V,p=0),Ver:0\r\n' expected_result = {