Skip to content

Commit

Permalink
test: compare extracted time in local time format to make tests succe…
Browse files Browse the repository at this point in the history
…ed in each timezone
  • Loading branch information
raymar9 committed Apr 5, 2024
1 parent 5e0c7a8 commit 9b7058c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/test_hdlc_dlms_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def test_parse_dlms_to_meter_data(self, unencrypted_valid_data_lg: List[bytes],
assert any(data.type == MeterDataPointTypes.ACTIVE_POWER_N.value for data in meter_data)
assert all(isinstance(data.value, float) for data in meter_data)
assert all(data.source == "LGZ1030655933512" for data in meter_data)
assert all(data.timestamp.strftime(r"%m/%d/%y %H:%M:%S") == "07/06/21 14:58:18" for data in meter_data)
assert all(data.timestamp.astimezone().strftime(r"%m/%d/%y %H:%M:%S")
== "07/06/21 14:58:18" for data in meter_data)

def test_parse_dlms_to_meter_data2(self, unencrypted_valid_data_lg2: List[bytes], cosem_config_lg: Cosem):
parser = prepare_parser(unencrypted_valid_data_lg2, cosem_config_lg)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_iskraam550.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def data_received():
assert any(data.type == MeterDataPointTypes.REACTIVE_ENERGY_Q4.value for data in values)
assert any(data.type == MeterDataPointTypes.POWER_FACTOR.value for data in values)
assert all(data.source == "ISK1030775213859" for data in values)
assert all(data.timestamp.strftime(r"%m/%d/%y %H:%M:%S") == "08/15/20 06:19:45" for data in values)
assert all(data.timestamp.astimezone().strftime(r"%m/%d/%y %H:%M:%S") == "08/15/20 06:19:45" for data in values)
2 changes: 1 addition & 1 deletion tests/test_lge450.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def data_received():
assert any(data.type == MeterDataPointTypes.REACTIVE_ENERGY_Q4.value for data in values)
assert any(data.type == MeterDataPointTypes.POWER_FACTOR.value for data in values)
assert all(data.source == "LGZ1030655933512" for data in values)
assert all(data.timestamp.strftime(r"%m/%d/%y %H:%M:%S") == "07/06/21 14:58:18" for data in values)
assert all(data.timestamp.astimezone().strftime(r"%m/%d/%y %H:%M:%S") == "07/06/21 14:58:18" for data in values)


@pytest.mark.asyncio
Expand Down
1 change: 0 additions & 1 deletion tests/test_lge570.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .utils import *


@pytest.mark.skipif(sys.version_info < (3, 8), reason="Python3.7 does not support AsyncMock.")
@pytest.mark.asyncio
async def test_lge570_parse_and_provide_encrypted_data(mocker: MockerFixture,
encrypted_valid_data_lge570: List[bytes]):
Expand Down

0 comments on commit 9b7058c

Please sign in to comment.