MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_generation_time

Method test_generation_time

test/test_objectid.py:89–95  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

87 self.assertEqual(a, ObjectId(str(a)))
88
89 def test_generation_time(self):
90 d1 = datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None)
91 d2 = ObjectId().generation_time
92
93 self.assertEqual(utc, d2.tzinfo)
94 d2 = d2.replace(tzinfo=None)
95 self.assertLess(d2 - d1, datetime.timedelta(seconds=2))
96
97 def test_from_datetime(self):
98 d = datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None)

Callers

nothing calls this directly

Calls 1

ObjectIdClass · 0.90

Tested by

no test coverage detected