MCPcopy Index your code
hub / github.com/encode/django-rest-framework / test_encode_datetime

Method test_encode_datetime

tests/test_encoders.py:35–42  ·  view source on GitHub ↗

Tests encoding a datetime object

(self)

Source from the content-addressed store, hash-verified

33 assert self.encoder.default(d) == float(d)
34
35 def test_encode_datetime(self):
36 """
37 Tests encoding a datetime object
38 """
39 current_time = datetime.now()
40 assert self.encoder.default(current_time) == current_time.isoformat()
41 current_time_utc = current_time.replace(tzinfo=utc)
42 assert self.encoder.default(current_time_utc) == current_time.isoformat() + 'Z'
43
44 def test_encode_time(self):
45 """

Callers

nothing calls this directly

Calls 1

defaultMethod · 0.80

Tested by

no test coverage detected