@@ -806,35 +806,6 @@ def test_deref_kwargs(self):
806
806
db .dereference (DBRef ("test" , 4 ),
807
807
projection = {"_id" : False }))
808
808
809
- @client_context .require_no_auth
810
- @client_context .require_version_max (4 , 1 , 0 )
811
- def test_eval (self ):
812
- db = self .client .pymongo_test
813
- db .test .drop ()
814
-
815
- with ignore_deprecations ():
816
- self .assertRaises (TypeError , db .eval , None )
817
- self .assertRaises (TypeError , db .eval , 5 )
818
- self .assertRaises (TypeError , db .eval , [])
819
-
820
- self .assertEqual (3 , db .eval ("function (x) {return x;}" , 3 ))
821
- self .assertEqual (3 , db .eval (u"function (x) {return x;}" , 3 ))
822
-
823
- self .assertEqual (None ,
824
- db .eval ("function (x) {db.test.save({y:x});}" , 5 ))
825
- self .assertEqual (db .test .find_one ()["y" ], 5 )
826
-
827
- self .assertEqual (5 , db .eval ("function (x, y) {return x + y;}" , 2 , 3 ))
828
- self .assertEqual (5 , db .eval ("function () {return 5;}" ))
829
- self .assertEqual (5 , db .eval ("2 + 3;" ))
830
-
831
- self .assertEqual (5 , db .eval (Code ("2 + 3;" )))
832
- self .assertRaises (OperationFailure , db .eval , Code ("return i;" ))
833
- self .assertEqual (2 , db .eval (Code ("return i;" , {"i" : 2 })))
834
- self .assertEqual (5 , db .eval (Code ("i + 3;" , {"i" : 2 })))
835
-
836
- self .assertRaises (OperationFailure , db .eval , "5 ++ 5;" )
837
-
838
809
# TODO some of these tests belong in the collection level testing.
839
810
def test_insert_find_one (self ):
840
811
db = self .client .pymongo_test
@@ -910,48 +881,6 @@ def test_delete(self):
910
881
db .test .delete_many ({})
911
882
self .assertFalse (db .test .find_one ())
912
883
913
- @client_context .require_no_auth
914
- @client_context .require_version_max (4 , 1 , 0 )
915
- def test_system_js (self ):
916
- db = self .client .pymongo_test
917
- db .system .js .delete_many ({})
918
-
919
- self .assertEqual (0 , db .system .js .count_documents ({}))
920
- db .system_js .add = "function(a, b) { return a + b; }"
921
- self .assertEqual ('add' , db .system .js .find_one ()['_id' ])
922
- self .assertEqual (1 , db .system .js .count_documents ({}))
923
- self .assertEqual (6 , db .system_js .add (1 , 5 ))
924
- del db .system_js .add
925
- self .assertEqual (0 , db .system .js .count_documents ({}))
926
-
927
- db .system_js ['add' ] = "function(a, b) { return a + b; }"
928
- self .assertEqual ('add' , db .system .js .find_one ()['_id' ])
929
- self .assertEqual (1 , db .system .js .count_documents ({}))
930
- self .assertEqual (6 , db .system_js ['add' ](1 , 5 ))
931
- del db .system_js ['add' ]
932
- self .assertEqual (0 , db .system .js .count_documents ({}))
933
- self .assertRaises (OperationFailure , db .system_js .add , 1 , 5 )
934
-
935
- # TODO right now CodeWScope doesn't work w/ system js
936
- # db.system_js.scope = Code("return hello;", {"hello": 8})
937
- # self.assertEqual(8, db.system_js.scope())
938
-
939
- self .assertRaises (OperationFailure , db .system_js .non_existant )
940
-
941
- def test_system_js_list (self ):
942
- db = self .client .pymongo_test
943
- db .system .js .delete_many ({})
944
- self .assertEqual ([], db .system_js .list ())
945
-
946
- db .system_js .foo = "function() { return 'blah'; }"
947
- self .assertEqual (["foo" ], db .system_js .list ())
948
-
949
- db .system_js .bar = "function() { return 'baz'; }"
950
- self .assertEqual (set (["foo" , "bar" ]), set (db .system_js .list ()))
951
-
952
- del db .system_js .foo
953
- self .assertEqual (["bar" ], db .system_js .list ())
954
-
955
884
def test_command_response_without_ok (self ):
956
885
# Sometimes (SERVER-10891) the server's response to a badly-formatted
957
886
# command document will have no 'ok' field. We should raise
0 commit comments