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

Method test_legacy_java_uuid_roundtrip

test/test_client.py:2140–2156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2138 self.db.t.create_index({"x": pymongo.ASCENDING})
2139
2140 def test_legacy_java_uuid_roundtrip(self):
2141 data = BinaryData.java_data
2142 docs = bson.decode_all(data, CodecOptions(SON[str, Any], False, JAVA_LEGACY))
2143
2144 client_context.client.pymongo_test.drop_collection("java_uuid")
2145 db = client_context.client.pymongo_test
2146 coll = db.get_collection("java_uuid", CodecOptions(uuid_representation=JAVA_LEGACY))
2147
2148 coll.insert_many(docs)
2149 self.assertEqual(5, coll.count_documents({}))
2150 for d in coll.find():
2151 self.assertEqual(d["newguid"], uuid.UUID(d["newguidstring"]))
2152
2153 coll = db.get_collection("java_uuid", CodecOptions(uuid_representation=PYTHON_LEGACY))
2154 for d in coll.find():
2155 self.assertNotEqual(d["newguid"], d["newguidstring"])
2156 client_context.client.pymongo_test.drop_collection("java_uuid")
2157
2158 def test_legacy_csharp_uuid_roundtrip(self):
2159 data = BinaryData.csharp_data

Callers

nothing calls this directly

Calls 6

CodecOptionsClass · 0.90
drop_collectionMethod · 0.45
get_collectionMethod · 0.45
insert_manyMethod · 0.45
count_documentsMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected