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(
100
100
"""
101
101
Send a script to MarkLogic via a POST to the endpoint
102
102
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.
104
105
105
106
:param javascript: a JavaScript script
106
107
:param xquery: an XQuery script
@@ -141,7 +142,8 @@ def invoke(
141
142
"""
142
143
Send a script (XQuery or JavaScript) and possibly a dict of vars
143
144
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.
145
147
146
148
:param module: The URI of a module in the modules database of the app server
147
149
: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:
20
20
MarkLogic server.
21
21
"""
22
22
if response_has_no_content (response ):
23
- return []
23
+ return None
24
24
25
25
parts = MultipartDecoder .from_response (response ).parts
26
26
transformed_parts = []
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ def query(
94
94
)
95
95
if response .ok and not return_response :
96
96
if response_has_no_content (response ):
97
- return []
97
+ return None
98
98
return (
99
99
response .json ()
100
100
if graphql
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def test_javascript_vars(client):
100
100
101
101
def test_xquery_empty_sequence (client ):
102
102
parts = client .eval (xquery = "()" )
103
- assert [] == parts
103
+ assert parts is None
104
104
105
105
106
106
def test_javascript_empty_array (client ):
@@ -110,7 +110,7 @@ def test_javascript_empty_array(client):
110
110
111
111
def test_javascript_empty_sequence (client ):
112
112
parts = client .eval (javascript = "Sequence.from([])" )
113
- assert [] == parts
113
+ assert parts is None
114
114
115
115
116
116
def test_base64Binary (client ):
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def test_dsl_default(client):
17
17
def test_no_rows_returned (client ):
18
18
query = 'op.fromView("test", "musician").where(op.eq(op.col("lastName"), "Smith"))'
19
19
results = client .rows .query (query )
20
- assert [] == results
20
+ assert results is None
21
21
22
22
23
23
def test_dsl_default_return_response (client ):
@@ -98,7 +98,7 @@ def test_transaction(client):
98
98
query = f'op.fromView("test", "musician")'
99
99
query = f'{ query } .where(op.eq(op.col("lastName"), "{ lastName } "))'
100
100
results = client .rows .query (query , tx = tx )
101
- assert len ( results ) == 0
101
+ assert results is None
102
102
103
103
perms = {"python-tester" : ["read" , "update" ]}
104
104
doc = Document (uri , content , permissions = perms )
@@ -109,7 +109,7 @@ def test_transaction(client):
109
109
110
110
client .delete ("/v1/documents" , params = {"uri" : uri , "txid" : tx .id })
111
111
results = client .rows .query (query , tx = tx )
112
- assert len ( results ) == 0
112
+ assert results is None
113
113
114
114
115
115
def verify_four_musicians_are_returned_in_json (data , column_name ):
You can’t perform that action at this time.
0 commit comments