Skip to content

Commit

Permalink
adapt to timezone-aware objects
Browse files Browse the repository at this point in the history
  • Loading branch information
MeggyCal committed Mar 26, 2024
1 parent c5e8151 commit 13461e9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/test_paexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from datetime import (
datetime,
timezone,
)

from pypsexec.exceptions import (
Expand Down Expand Up @@ -265,15 +266,15 @@ def test_parse_message(self):
assert src_files[0]['filename'].get_value() == \
"src1".encode('utf-16-le')
assert src_files[0]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert src_files[0]['file_version_ls'].get_value() == 0
assert src_files[0]['file_version_ms'].get_value() == 0
assert not src_files[0]['copy_file'].get_value()
assert src_files[1]['filename_len'].get_value() == 4
assert src_files[1]['filename'].get_value() == \
"src2".encode('utf-16-le')
assert src_files[1]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert src_files[1]['file_version_ls'].get_value() == 0
assert src_files[1]['file_version_ms'].get_value() == 0
assert not src_files[1]['copy_file'].get_value()
Expand All @@ -284,15 +285,15 @@ def test_parse_message(self):
assert dest_files[0]['filename'].get_value() == \
"dest1".encode('utf-16-le')
assert dest_files[0]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert dest_files[0]['file_version_ls'].get_value() == 0
assert dest_files[0]['file_version_ms'].get_value() == 0
assert not dest_files[0]['copy_file'].get_value()
assert dest_files[1]['filename_len'].get_value() == 5
assert dest_files[1]['filename'].get_value() == \
"dest2".encode('utf-16-le')
assert dest_files[1]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert dest_files[1]['file_version_ls'].get_value() == 0
assert dest_files[1]['file_version_ms'].get_value() == 0
assert not dest_files[1]['copy_file'].get_value()
Expand Down Expand Up @@ -516,15 +517,15 @@ def test_parse_message(self):
assert src_files[0]['filename'].get_value() == \
"src1".encode('utf-16-le')
assert src_files[0]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert src_files[0]['file_version_ls'].get_value() == 0
assert src_files[0]['file_version_ms'].get_value() == 0
assert not src_files[0]['copy_file'].get_value()
assert src_files[1]['filename_len'].get_value() == 4
assert src_files[1]['filename'].get_value() == \
"src2".encode('utf-16-le')
assert src_files[1]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert src_files[1]['file_version_ls'].get_value() == 0
assert src_files[1]['file_version_ms'].get_value() == 0
assert not src_files[1]['copy_file'].get_value()
Expand All @@ -535,15 +536,15 @@ def test_parse_message(self):
assert dest_files[0]['filename'].get_value() == \
"dest1".encode('utf-16-le')
assert dest_files[0]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert dest_files[0]['file_version_ls'].get_value() == 0
assert dest_files[0]['file_version_ms'].get_value() == 0
assert not dest_files[0]['copy_file'].get_value()
assert dest_files[1]['filename_len'].get_value() == 5
assert dest_files[1]['filename'].get_value() == \
"dest2".encode('utf-16-le')
assert dest_files[1]['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert dest_files[1]['file_version_ls'].get_value() == 0
assert dest_files[1]['file_version_ms'].get_value() == 0
assert not dest_files[1]['copy_file'].get_value()
Expand Down Expand Up @@ -583,7 +584,7 @@ def test_parse_message(self):
assert actual['filename_len'].get_value() == 4
assert actual['filename'].get_value() == "file".encode('utf-16-le-')
assert actual['file_last_write'].get_value() == \
datetime.utcfromtimestamp(0)
datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
assert actual['file_version_ls'].get_value() == 10
assert actual['file_version_ms'].get_value() == 10
assert actual['copy_file'].get_value()
Expand Down

0 comments on commit 13461e9

Please sign in to comment.