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

Method test_decode_all_defaults

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

Source from the content-addressed store, hash-verified

1306 self.assertEqual(r, repr(CodecOptions()))
1307
1308 def test_decode_all_defaults(self):
1309 # Test decode_all()'s default document_class is dict and tz_aware is
1310 # False.
1311 doc = {"sub_document": {}, "dt": datetime.datetime.now(tz=datetime.timezone.utc)}
1312
1313 decoded = bson.decode_all(bson.encode(doc))[0]
1314 self.assertIsInstance(decoded["sub_document"], dict)
1315 self.assertIsNone(decoded["dt"].tzinfo)
1316 # The default uuid_representation is UNSPECIFIED
1317 with self.assertRaisesRegex(ValueError, "cannot encode native uuid"):
1318 bson.decode_all(bson.encode({"uuid": uuid.uuid4()}))
1319
1320 def test_decode_all_no_options(self):
1321 # Test decode_all()'s default document_class is dict and tz_aware is

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected