@@ -63,18 +63,8 @@ def test_objectid(self):
63
63
def test_dbref (self ):
64
64
self .round_trip ({"ref" : DBRef ("foo" , 5 )})
65
65
self .round_trip ({"ref" : DBRef ("foo" , 5 , "db" )})
66
-
67
- # TODO this is broken when using cjson. See:
68
- # http://jira.mongodb.org/browse/PYTHON-153
69
- # http://bugs.python.org/issue6105
70
- #
71
- # self.assertEqual("{\"ref\": {\"$ref\": \"foo\", \"$id\": 5}}",
72
- # json.dumps({"ref": DBRef("foo", 5)},
73
- # default=json_util.default))
74
- # self.assertEqual("{\"ref\": {\"$ref\": \"foo\",
75
- # \"$id\": 5, \"$db\": \"bar\"}}",
76
- # json.dumps({"ref": DBRef("foo", 5, "bar")},
77
- # default=json_util.default))
66
+ self .round_trip ({"ref" : DBRef ("foo" , ObjectId ())})
67
+ self .round_trip ({"ref" : DBRef ("foo" , ObjectId (), "db" )})
78
68
79
69
def test_datetime (self ):
80
70
# only millis, not micros
@@ -128,7 +118,9 @@ def test_cursor(self):
128
118
{'foo' : [1 , 2 ]},
129
119
{'bar' : {'hello' : 'world' }},
130
120
{'code' : Code ("function x() { return 1; }" )},
131
- {'bin' : Binary (b ("\x00 \x01 \x02 \x03 \x04 " ))}
121
+ {'bin' : Binary (b ("\x00 \x01 \x02 \x03 \x04 " ))},
122
+ {'dbref' : {'_ref' : DBRef ('simple' ,
123
+ ObjectId ('509b8db456c02c5ab7e63c34' ))}}
132
124
]
133
125
134
126
db .test .insert (docs )
0 commit comments