diff options
author | ptmcg <ptmcg@austin.rr.com> | 2018-09-19 23:14:54 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2018-09-19 23:14:54 -0500 |
commit | 5e5c94a6f0e907679ecd4e5aeecffd12edd48889 (patch) | |
tree | baaf601915e3637d275937609f10d3106aeea7a7 /simple_unit_tests.py | |
parent | c701a87b1f3c938ae34c3f06ee4566dcf560768e (diff) | |
download | pyparsing-git-5e5c94a6f0e907679ecd4e5aeecffd12edd48889.tar.gz |
convert to datetimes using utc, not local time
Diffstat (limited to 'simple_unit_tests.py')
-rw-r--r-- | simple_unit_tests.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/simple_unit_tests.py b/simple_unit_tests.py index f28c8ca..4c5c017 100644 --- a/simple_unit_tests.py +++ b/simple_unit_tests.py @@ -205,15 +205,15 @@ class TestParseAction(PyparsingExpressionTestCase): PpTestSpec( desc = "Use two parse actions to convert numeric string, then convert to datetime", expr = pp.Word(pp.nums).addParseAction(lambda t: int(t[0]), - lambda t: datetime.fromtimestamp(t[0])), + lambda t: datetime.utcfromtimestamp(t[0])), text = "1537415628", - expected_list = [datetime(2018, 9, 19, 22, 53, 48)], + expected_list = [datetime(2018, 9, 20, 3, 53, 48)], ), PpTestSpec( desc = "Use tokenMap for parse actions that operate on a single-length token", - expr = pp.Word(pp.nums).addParseAction(pp.tokenMap(int), pp.tokenMap(datetime.fromtimestamp)), + expr = pp.Word(pp.nums).addParseAction(pp.tokenMap(int), pp.tokenMap(datetime.utcfromtimestamp)), text = "1537415628", - expected_list = [datetime(2018, 9, 19, 22, 53, 48)], + expected_list = [datetime(2018, 9, 20, 3, 53, 48)], ), ] |