(self)
| 563 | self.assertIsNone(json_util.loads(jsn)["name"]) |
| 564 | |
| 565 | def test_numberlong(self): |
| 566 | jsn = '{"weight": {"$numberLong": "65535"}}' |
| 567 | self.assertEqual(json_util.loads(jsn)["weight"], Int64(65535)) |
| 568 | self.assertEqual(json_util.dumps({"weight": Int64(65535)}), '{"weight": 65535}') |
| 569 | json_options = JSONOptions(strict_number_long=True, json_mode=JSONMode.LEGACY) |
| 570 | self.assertEqual(json_util.dumps({"weight": Int64(65535)}, json_options=json_options), jsn) |
| 571 | # Ensure json_util.default converts Int64 to int in non-strict mode. |
| 572 | converted = json_util.default(Int64(65535)) |
| 573 | self.assertEqual(converted, 65535) |
| 574 | self.assertNotIsInstance(converted, Int64) |
| 575 | self.assertEqual( |
| 576 | json_util.default(Int64(65535), json_options=json_options), {"$numberLong": "65535"} |
| 577 | ) |
| 578 | |
| 579 | def test_loads_document_class(self): |
| 580 | json_doc = '{"foo": "bar", "b": 1, "d": {"a": 1}}' |
nothing calls this directly
no test coverage detected