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

Method test_dbref

test/test_json_util.py:111–120  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

109 self.round_trip({"id": ObjectId()})
110
111 def test_dbref(self):
112 self.round_trip({"ref": DBRef("foo", 5)})
113 self.round_trip({"ref": DBRef("foo", 5, "db")})
114 self.round_trip({"ref": DBRef("foo", ObjectId())})
115
116 # Check order.
117 self.assertEqual(
118 '{"$ref": "collection", "$id": 1, "$db": "db"}',
119 json_util.dumps(DBRef("collection", 1, "db")),
120 )
121
122 def test_datetime(self):
123 tz_aware_opts = json_util.DEFAULT_JSON_OPTIONS.with_options(tz_aware=True)

Callers

nothing calls this directly

Calls 3

round_tripMethod · 0.95
DBRefClass · 0.90
ObjectIdClass · 0.90

Tested by

no test coverage detected