File tree Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ def eval(
100100 """
101101 Send a script to MarkLogic via a POST to the endpoint
102102 defined at https://docs.marklogic.com/REST/POST/v1/eval. Must define either
103- 'javascript' or 'xquery'.
103+ 'javascript' or 'xquery'. Returns a list, unless no content is returned in
104+ which case None is returned.
104105
105106 :param javascript: a JavaScript script
106107 :param xquery: an XQuery script
@@ -141,7 +142,8 @@ def invoke(
141142 """
142143 Send a script (XQuery or JavaScript) and possibly a dict of vars
143144 to MarkLogic via a POST to the endpoint defined at
144- https://docs.marklogic.com/REST/POST/v1/eval.
145+ https://docs.marklogic.com/REST/POST/v1/eval. Returns a list, unless no content
146+ is returned in which case None is returned.
145147
146148 :param module: The URI of a module in the modules database of the app server
147149 :param vars: a dict containing variables to include
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def process_multipart_mixed_response(response: Response) -> list:
2020 MarkLogic server.
2121 """
2222 if response_has_no_content (response ):
23- return []
23+ return None
2424
2525 parts = MultipartDecoder .from_response (response ).parts
2626 transformed_parts = []
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ def query(
9494 )
9595 if response .ok and not return_response :
9696 if response_has_no_content (response ):
97- return []
97+ return None
9898 return (
9999 response .json ()
100100 if graphql
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def test_javascript_vars(client):
100100
101101def test_xquery_empty_sequence (client ):
102102 parts = client .eval (xquery = "()" )
103- assert [] == parts
103+ assert parts is None
104104
105105
106106def test_javascript_empty_array (client ):
@@ -110,7 +110,7 @@ def test_javascript_empty_array(client):
110110
111111def test_javascript_empty_sequence (client ):
112112 parts = client .eval (javascript = "Sequence.from([])" )
113- assert [] == parts
113+ assert parts is None
114114
115115
116116def test_base64Binary (client ):
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def test_dsl_default(client):
1717def test_no_rows_returned (client ):
1818 query = 'op.fromView("test", "musician").where(op.eq(op.col("lastName"), "Smith"))'
1919 results = client .rows .query (query )
20- assert [] == results
20+ assert results is None
2121
2222
2323def test_dsl_default_return_response (client ):
@@ -98,7 +98,7 @@ def test_transaction(client):
9898 query = f'op.fromView("test", "musician")'
9999 query = f'{ query } .where(op.eq(op.col("lastName"), "{ lastName } "))'
100100 results = client .rows .query (query , tx = tx )
101- assert len ( results ) == 0
101+ assert results is None
102102
103103 perms = {"python-tester" : ["read" , "update" ]}
104104 doc = Document (uri , content , permissions = perms )
@@ -109,7 +109,7 @@ def test_transaction(client):
109109
110110 client .delete ("/v1/documents" , params = {"uri" : uri , "txid" : tx .id })
111111 results = client .rows .query (query , tx = tx )
112- assert len ( results ) == 0
112+ assert results is None
113113
114114
115115def verify_four_musicians_are_returned_in_json (data , column_name ):
You can’t perform that action at this time.
0 commit comments