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

Method test_code

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

Source from the content-addressed store, hash-verified

546 )
547
548 def test_code(self):
549 self.round_trip({"code": Code("function x() { return 1; }")})
550
551 code = Code("return z", z=2)
552 res = json_util.dumps(code)
553 self.assertEqual(code, json_util.loads(res))
554
555 # Check order.
556 self.assertEqual('{"$code": "return z", "$scope": {"z": 2}}', res)
557
558 no_scope = Code("function() {}")
559 self.assertEqual('{"$code": "function() {}"}', json_util.dumps(no_scope))
560
561 def test_undefined(self):
562 jsn = '{"name": {"$undefined": true}}'

Callers

nothing calls this directly

Calls 2

round_tripMethod · 0.95
CodeClass · 0.90

Tested by

no test coverage detected