@@ -236,40 +236,53 @@ def test_disconnect(self):
236236 coll .count ()
237237
238238 def test_parse_uri (self ):
239- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
239+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
240240 _parse_uri ("localhost" , 27017 ))
241- self .assertEqual (([("localhost" , 27018 )], None , None , None ),
241+ self .assertEqual (([("localhost" , 27018 )], None , None , None , None , {} ),
242242 _parse_uri ("localhost" , 27018 ))
243243 self .assertRaises (InvalidURI , _parse_uri ,
244244 "http://foobar.com" , 27017 )
245245 self .assertRaises (InvalidURI , _parse_uri ,
246246 "http://[email protected] " ,
27017 )
247247
248- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
248+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
249249 _parse_uri ("mongodb://localhost" , 27017 ))
250- self .assertEqual (([("localhost" , 27017 )], None , "fred" , "foobar" ),
250+ self .assertEqual (([("localhost" , 27017 )], None , "fred" , "foobar" , None , {} ),
251251 _parse_uri ("mongodb://fred:foobar@localhost" ,
252252 27017 ))
253- self .assertEqual (([("localhost" , 27017 )], "baz" , "fred" , "foobar" ),
253+ self .assertEqual (([("localhost" , 27017 )], "baz" , "fred" , "foobar" , None , {} ),
254254 _parse_uri ("mongodb://fred:foobar@localhost/baz" ,
255255 27017 ))
256256 self .assertEqual (([("example1.com" , 27017 ), ("example2.com" , 27017 )],
257- None , None , None ),
257+ None , None , None , None , {} ),
258258 _parse_uri ("mongodb://example1.com:27017,example2.com:27017" ,
259259 27018 ))
260260 self .assertEqual (([("localhost" , 27017 ),
261261 ("localhost" , 27018 ),
262- ("localhost" , 27019 )], None , None , None ),
262+ ("localhost" , 27019 )], None , None , None , None , {} ),
263263 _parse_uri ("mongodb://localhost,localhost:27018,localhost:27019" ,
264264 27017 ))
265265
266- self .assertEqual (([("localhost" , 27018 )], None , None , None ),
266+ self .assertEqual (([("localhost" , 27018 )], None , None , None , None , {} ),
267267 _parse_uri ("localhost:27018" , 27017 ))
268- self .assertEqual (([("localhost" , 27017 )], "foo" , None , None ),
268+ self .assertEqual (([("localhost" , 27017 )], "foo" , None , None , None , {} ),
269269 _parse_uri ("localhost/foo" , 27017 ))
270- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
270+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
271271 _parse_uri ("localhost/" , 27017 ))
272272
273+ self .assertEqual (([("localhost" , 27017 )], "test" , None , None , "yield_historical.in" , {}),
274+ _parse_uri ("mongodb://localhost/test.yield_historical.in" , 27017 ))
275+ self .assertEqual (([("localhost" , 27017 )], "test" , "fred" , "foobar" , "yield_historical.in" , {}),
276+ _parse_uri ("mongodb://fred:foobar@localhost/test.yield_historical.in" ,
277+ 27017 ))
278+ self .assertEqual (([("example1.com" , 27017 ), ("example2.com" , 27017 )],
279+ "test" , None , None , "yield_historical.in" , {}),
280+ _parse_uri ("mongodb://example1.com:27017,example2.com:27017/test.yield_historical.in" ,
281+ 27017 ))
282+ self .assertEqual (([("localhost" , 27017 )], "test" , "fred" , "foobar" , "yield_historical.in" , {'slaveok' : 'true' }),
283+ _parse_uri ("mongodb://fred:foobar@localhost/test.yield_historical.in?slaveok=true" ,
284+ 27017 ))
285+
273286 def test_from_uri (self ):
274287 c = Connection (self .host , self .port )
275288
@@ -304,6 +317,8 @@ def test_from_uri(self):
304317 self .assert_ (Connection ("mongodb://%s:%s" %
305318 (self .host , self .port ),
306319 slave_okay = True ).slave_okay )
320+ self .assert_ (Connection ("mongodb://%s:%s/?slaveok=true;w=2" %
321+ (self .host , self .port )).slave_okay )
307322
308323 def test_fork (self ):
309324 """Test using a connection before and after a fork.
0 commit comments