Skip to content

Commit

Permalink
igc/reader: fix for HFTZN to handle timezone that is not integer (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
bubeck authored Sep 10, 2024
1 parent 184eb24 commit bfd6a16
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion aerofiles/igc/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
20 changes: 20 additions & 0 deletions tests/igc/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit bfd6a16

Please sign in to comment.