Skip to content

Commit

Permalink
remove left-over logic & add test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazcy committed Aug 8, 2024
1 parent 54713b2 commit 2dd690e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ def extract_request_options(gremlin_lang):
request_options.update({token: os.configuration[token] for token in TokensV4
if token in os.configuration})
if gremlin_lang.parameters is not None and len(gremlin_lang.parameters) > 0:
if request_options is None:
request_options = gremlin_lang.parameters
else:
request_options["params"] = gremlin_lang.parameters
request_options["params"] = gremlin_lang.parameters

return request_options
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import pytest
from gremlin_python import statics
from gremlin_python.statics import long
from gremlin_python.process.traversal import TraversalStrategy
from gremlin_python.process.traversal import P, Order, T
from gremlin_python.process.traversal import TraversalStrategy, P, Order, T, Parameter
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.structure.graph import Vertex
Expand All @@ -44,6 +43,17 @@ def test_extract_request_options(self, remote_connection):
'evaluationTimeout': 1000}
assert 6 == t.to_list()[0]

def test_extract_request_options_with_params(self, remote_connection):
g = traversal().with_(remote_connection)
t = g.with_("evaluationTimeout",
1000).with_("batchSize", 100).with_("userAgent",
"test").V(Parameter.var('ids', [1, 2, 3])).count()
assert remote_connection.extract_request_options(t.gremlin_lang) == {'batchSize': 100,
'evaluationTimeout': 1000,
'userAgent': 'test',
'params': {'ids': [1, 2, 3]}}
assert 3 == t.to_list()[0]

def test_traversals(self, remote_connection):
statics.load_statics(globals())
g = traversal().with_(remote_connection)
Expand Down

0 comments on commit 2dd690e

Please sign in to comment.