summaryrefslogtreecommitdiff
path: root/t/unit
diff options
context:
space:
mode:
authordobosevych <dobosevych@users.noreply.github.com>2022-05-31 08:21:04 +0300
committerGitHub <noreply@github.com>2022-05-31 11:21:04 +0600
commitc4829754db0f0a5b10265309d327875694d33ab4 (patch)
tree49bb1d662f6672442aa817cac09a8f90b357d7f2 /t/unit
parent0a2f54eac2d57925a448cbb307a74b92f9f370b2 (diff)
downloadkombu-c4829754db0f0a5b10265309d327875694d33ab4.tar.gz
Datetime serialization and deserialization fixed (#1515)
* Datetime serialization and deserialization fixed * Unit test fixed * Unit test fixed * Fixed pylint * Added Undocumented Autodoc Modules * Update kombu/utils/json.py Co-authored-by: Omer Katz <omer.katz@omerkatz.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Clean and freeze now * Clean and freeze now * Clean and freeze now * Clean and freeze now Co-authored-by: Asif Saif Uddin <auvipy@gmail.com> Co-authored-by: Omer Katz <omer.katz@omerkatz.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 't/unit')
-rw-r--r--t/unit/utils/test_json.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/t/unit/utils/test_json.py b/t/unit/utils/test_json.py
index c263b4f9..54d559e4 100644
--- a/t/unit/utils/test_json.py
+++ b/t/unit/utils/test_json.py
@@ -25,11 +25,10 @@ class Custom:
class test_JSONEncoder:
-
+ @pytest.mark.freeze_time("2015-10-21")
def test_datetime(self):
now = datetime.utcnow()
now_utc = now.replace(tzinfo=pytz.utc)
- stripped = datetime(*now.timetuple()[:3])
serialized = loads(dumps({
'datetime': now,
'tz': now_utc,
@@ -37,10 +36,10 @@ class test_JSONEncoder:
'time': now.time()},
))
assert serialized == {
- 'datetime': now.isoformat(),
- 'tz': '{}Z'.format(now_utc.isoformat().split('+', 1)[0]),
+ 'datetime': now,
+ 'tz': now_utc,
'time': now.time().isoformat(),
- 'date': stripped.isoformat(),
+ 'date': datetime(now.year, now.month, now.day, 0, 0, 0, 0),
}
@given(message=st.binary())