@@ -633,17 +633,17 @@ def iterate():
633
633
634
634
def test_invalid_key_names (self ):
635
635
db = self .db
636
- db .test .remove ({} )
636
+ db .test .drop ( )
637
637
638
- db .test .insert ({"hello" : "world" })
639
- db .test .insert ({"hello" : {"hello" : "world" }})
638
+ db .test .insert ({"hello" : "world" }, safe = True )
639
+ db .test .insert ({"hello" : {"hello" : "world" }}, safe = True )
640
640
641
641
self .assertRaises (InvalidDocument , db .test .insert , {"$hello" : "world" })
642
642
self .assertRaises (InvalidDocument , db .test .insert ,
643
643
{"hello" : {"$hello" : "world" }})
644
644
645
- db .test .insert ({"he$llo" : "world" })
646
- db .test .insert ({"hello" : {"hello$" : "world" }})
645
+ db .test .insert ({"he$llo" : "world" }, safe = True )
646
+ db .test .insert ({"hello" : {"hello$" : "world" }}, safe = True )
647
647
648
648
self .assertRaises (InvalidDocument , db .test .insert ,
649
649
{".hello" : "world" })
@@ -666,7 +666,7 @@ def test_insert_multiple(self):
666
666
doc1 = {"hello" : u"world" }
667
667
doc2 = {"hello" : u"mike" }
668
668
self .assertEqual (db .test .find ().count (), 0 )
669
- ids = db .test .insert ([doc1 , doc2 ])
669
+ ids = db .test .insert ([doc1 , doc2 ], safe = True )
670
670
self .assertEqual (db .test .find ().count (), 2 )
671
671
self .assertEqual (doc1 , db .test .find_one ({"hello" : u"world" }))
672
672
self .assertEqual (doc2 , db .test .find_one ({"hello" : u"mike" }))
@@ -691,7 +691,7 @@ def test_insert_multiple_with_duplicate(self):
691
691
db .test .remove ()
692
692
693
693
# No error
694
- db .test .insert ([{'i' : 1 }] * 2 )
694
+ db .test .insert ([{'i' : 1 }] * 2 , safe = False )
695
695
self .assertEqual (1 , db .test .count ())
696
696
697
697
self .assertRaises (
0 commit comments