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

Method test_exception_wrapping

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

Source from the content-addressed store, hash-verified

1094 self.assertEqual(re1, re2)
1095
1096 def test_exception_wrapping(self):
1097 # No matter what exception is raised while trying to decode BSON,
1098 # the final exception always matches InvalidBSON.
1099
1100 # {'s': '\xff'}, will throw attempting to decode utf-8.
1101 bad_doc = b"\x0f\x00\x00\x00\x02s\x00\x03\x00\x00\x00\xff\x00\x00\x00"
1102
1103 with self.assertRaises(InvalidBSON) as context:
1104 decode_all(bad_doc)
1105
1106 self.assertIn("codec can't decode byte 0xff", str(context.exception))
1107
1108 def test_minkey_maxkey_comparison(self):
1109 # MinKey's <, <=, >, >=, !=, and ==.

Callers

nothing calls this directly

Calls 1

decode_allFunction · 0.90

Tested by

no test coverage detected