MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_naive_decode

Method test_naive_decode

test/test_bson.py:669–677  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

667 self.assertEqual(epoch, decode(encode(doc), codec_options=local_co)["epoch"])
668
669 def test_naive_decode(self):
670 aware = datetime.datetime(1993, 4, 4, 2, tzinfo=FixedOffset(555, "SomeZone"))
671 offset = aware.utcoffset()
672 assert offset is not None
673 naive_utc = (aware - offset).replace(tzinfo=None)
674 self.assertEqual(datetime.datetime(1993, 4, 3, 16, 45), naive_utc)
675 after = decode(encode({"date": aware}))["date"]
676 self.assertEqual(None, after.tzinfo)
677 self.assertEqual(naive_utc, after)
678
679 def test_dst(self):
680 d = {"x": datetime.datetime(1993, 4, 4, 2)}

Callers

nothing calls this directly

Calls 4

FixedOffsetClass · 0.90
decodeFunction · 0.90
encodeFunction · 0.90
utcoffsetMethod · 0.45

Tested by

no test coverage detected