@@ -48,7 +48,7 @@ def make_col(base, name):
4848 self .assertRaises (InvalidName , make_col , self .db .test , "test." )
4949 self .assertRaises (InvalidName , make_col , self .db .test , "tes..t" )
5050
51- self .assertTrue (isinstance (self .db .test , Collection ))
51+ self .assert_ (isinstance (self .db .test , Collection ))
5252 self .assertEqual (self .db .test , self .db ["test" ])
5353 self .assertEqual (self .db .test , Collection (self .db , "test" ))
5454 self .assertEqual (self .db .test .mike , self .db ["test.mike" ])
@@ -65,7 +65,7 @@ def test_create_index(self):
6565 self .assertRaises (TypeError , db .test .create_index , "hello" , "world" )
6666
6767 db .test .drop_indexes ()
68- self .assertFalse (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
68+ self .failIf (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
6969
7070 db .test .create_index ("hello" , ASCENDING )
7171 db .test .create_index ([("hello" , DESCENDING ), ("world" , ASCENDING )])
@@ -76,15 +76,15 @@ def test_create_index(self):
7676 self .assertEqual (count , 2 )
7777
7878 db .test .drop_indexes ()
79- self .assertFalse (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
79+ self .failIf (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
8080 db .test .create_index ("hello" , ASCENDING )
8181 self .assertEqual (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }),
8282 SON ([(u"name" , u"hello_1" ),
8383 (u"ns" , u"pymongo_test.test" ),
8484 (u"key" , SON ([(u"hello" , 1 )]))]))
8585
8686 db .test .drop_indexes ()
87- self .assertFalse (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
87+ self .failIf (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }))
8888 db .test .create_index ([("hello" , DESCENDING ), ("world" , ASCENDING )])
8989 self .assertEqual (db .system .indexes .find_one ({"ns" : u"pymongo_test.test" }),
9090 SON ([(u"name" , u"hello_-1_world_1" ),
@@ -145,9 +145,9 @@ def test_index_info(self):
145145 db .test .create_index ([("hello" , DESCENDING ), ("world" , ASCENDING )])
146146 self .assertEqual (db .test .index_information ()["hello_1" ], [("hello" , ASCENDING )])
147147 self .assertEqual (len (db .test .index_information ()), 2 )
148- self .assertTrue (("hello" , DESCENDING ) in db .test .index_information ()["hello_-1_world_1" ])
149- self .assertTrue (("world" , ASCENDING ) in db .test .index_information ()["hello_-1_world_1" ])
150- self .assertTrue (len (db .test .index_information ()["hello_-1_world_1" ]) == 2 )
148+ self .assert_ (("hello" , DESCENDING ) in db .test .index_information ()["hello_-1_world_1" ])
149+ self .assert_ (("world" , ASCENDING ) in db .test .index_information ()["hello_-1_world_1" ])
150+ self .assert_ (len (db .test .index_information ()["hello_-1_world_1" ]) == 2 )
151151
152152 def test_options (self ):
153153 db = self .db
@@ -184,15 +184,15 @@ def test_find_w_fields(self):
184184
185185 db .test .insert ({"x" : 1 , "mike" : "awesome" , "extra thing" : "abcdefghijklmnopqrstuvwxyz" })
186186 self .assertEqual (1 , db .test .count ())
187- self .assertTrue ("x" in db .test .find ({}).next ())
188- self .assertTrue ("mike" in db .test .find ({}).next ())
189- self .assertTrue ("extra thing" in db .test .find ({}).next ())
190- self .assertTrue ("x" in db .test .find ({}, ["x" , "mike" ]).next ())
191- self .assertTrue ("mike" in db .test .find ({}, ["x" , "mike" ]).next ())
192- self .assertFalse ("extra thing" in db .test .find ({}, ["x" , "mike" ]).next ())
193- self .assertFalse ("x" in db .test .find ({}, ["mike" ]).next ())
194- self .assertTrue ("mike" in db .test .find ({}, ["mike" ]).next ())
195- self .assertFalse ("extra thing" in db .test .find ({}, ["mike" ]).next ())
187+ self .assert_ ("x" in db .test .find ({}).next ())
188+ self .assert_ ("mike" in db .test .find ({}).next ())
189+ self .assert_ ("extra thing" in db .test .find ({}).next ())
190+ self .assert_ ("x" in db .test .find ({}, ["x" , "mike" ]).next ())
191+ self .assert_ ("mike" in db .test .find ({}, ["x" , "mike" ]).next ())
192+ self .failIf ("extra thing" in db .test .find ({}, ["x" , "mike" ]).next ())
193+ self .failIf ("x" in db .test .find ({}, ["mike" ]).next ())
194+ self .assert_ ("mike" in db .test .find ({}, ["mike" ]).next ())
195+ self .failIf ("extra thing" in db .test .find ({}, ["mike" ]).next ())
196196
197197 def test_find_w_regex (self ):
198198 db = self .db
@@ -215,7 +215,7 @@ def test_id_can_be_anything(self):
215215 db .test .remove ({})
216216 auto_id = {"hello" : "world" }
217217 db .test .insert (auto_id )
218- self .assertTrue (isinstance (auto_id ["_id" ], ObjectId ))
218+ self .assert_ (isinstance (auto_id ["_id" ], ObjectId ))
219219
220220 numeric = {"_id" : 240 , "hello" : "world" }
221221 db .test .insert (numeric )
@@ -227,7 +227,7 @@ def test_id_can_be_anything(self):
227227
228228 for x in db .test .find ():
229229 self .assertEqual (x ["hello" ], u"world" )
230- self .assertTrue ("_id" in x )
230+ self .assert_ ("_id" in x )
231231
232232 def test_iteration (self ):
233233 db = self .db
0 commit comments