This is an automated email from the ASF dual-hosted git repository.

kenhuuu pushed a commit to branch stringify-params
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit bffbe77c3c797533587acf913232a02ab24d1ee1
Author: Ken Hu <[email protected]>
AuthorDate: Mon Apr 27 13:14:29 2026 -0700

    test fixes
---
 .../Driver/DriverRemoteConnectionTests.cs                  |  6 +++---
 .../src/main/python/gremlin_python/process/traversal.py    | 14 +++++++++-----
 .../main/python/tests/integration/driver/test_client.py    |  8 ++++----
 .../src/main/python/tests/unit/process/test_strategies.py  |  7 ++-----
 4 files changed, 18 insertions(+), 17 deletions(-)

diff --git 
a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/DriverRemoteConnectionTests.cs
 
b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/DriverRemoteConnectionTests.cs
index 7a67ce668f..2e83c1120b 100644
--- 
a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/DriverRemoteConnectionTests.cs
+++ 
b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/DriverRemoteConnectionTests.cs
@@ -110,14 +110,14 @@ namespace Gremlin.Net.UnitTest.Driver
             var connection = new DriverRemoteConnection(client, "g");
 
             var gl = new GremlinLang();
-            gl.Parameters["_0"] = 42;
+            gl.Parameters["x"] = 42;
             gl.AddStep("V", Array.Empty<object>());
 
             await connection.SubmitAsync<object, object>(gl);
 
             Assert.NotNull(capturedRequest);
-            var bindings = (Dictionary<string, 
object>)capturedRequest!.Fields[Tokens.ArgsBindings];
-            Assert.Equal(42, bindings["_0"]);
+            var bindingsString = 
(string)capturedRequest!.Fields[Tokens.ArgsBindings];
+            Assert.Contains("\"x\":42", bindingsString);
         }
 
         [Fact]
diff --git a/gremlin-python/src/main/python/gremlin_python/process/traversal.py 
b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
index fc9f352309..76c91822e7 100644
--- a/gremlin-python/src/main/python/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
@@ -937,11 +937,15 @@ class GremlinLang(object):
         if isinstance(arg, list):
             return self._process_list(arg)
 
-        if hasattr(arg, '__class__'):
-            try:
-                return arg.__name__
-            except AttributeError:
-                pass
+        # Strategy instances render as their name (e.g. "ReadOnlyStrategy") 
for withoutStrategies.
+        # Class objects render as their __name__ (e.g. strategy classes passed 
directly).
+        # These replace the old hasattr(arg, '__class__') check which was too 
broad since every
+        # Python object has __class__, making it a silent escape hatch for 
anything with __name__.
+        if isinstance(arg, TraversalStrategy):
+            return arg.strategy_name
+
+        if isinstance(arg, type):
+            return arg.__name__
 
         raise TypeError(f'GremlinLang contains at least one type 
[{type(arg).__name__}] that cannot be represented as text.')
 
diff --git 
a/gremlin-python/src/main/python/tests/integration/driver/test_client.py 
b/gremlin-python/src/main/python/tests/integration/driver/test_client.py
index 2c8c04c4f2..a21590fb6c 100644
--- a/gremlin-python/src/main/python/tests/integration/driver/test_client.py
+++ b/gremlin-python/src/main/python/tests/integration/driver/test_client.py
@@ -261,7 +261,7 @@ def 
test_client_gremlin_lang_request_options_with_binding(client):
     g = GraphTraversalSource(Graph(), TraversalStrategies())
     # Note that bindings for constructed traversals is done via Parameter only
     t = g.with_('language', 'gremlin-lang').V(GValue('x', [1, 2, 3])).count()
-    request_opts = {'language': 'gremlin-lang', 'params': {'x': [1, 2, 3]}}
+    request_opts = {'language': 'gremlin-lang', 'bindings': {'x': [1, 2, 3]}}
     message = create_basic_request_message(t)
     result_set = client.submit(message, request_options=request_opts)
     assert result_set.all().result()[0] == 3
@@ -269,10 +269,10 @@ def 
test_client_gremlin_lang_request_options_with_binding(client):
     result_set = client.submit('g.V(x).values("name")', 
request_options=request_opts)
     assert result_set.all().result()[0] == 'marko'
     # For script submission only, we can also add bindings to request options 
and they will be applied
-    request_opts['bindings'] = {'y': 4}
-    result_set = client.submit('g.V(y).values("name")', 
request_options=request_opts)
+    request_opts2 = {'language': 'gremlin-lang', 'bindings': {'y': 4}}
+    result_set = client.submit('g.V(y).values("name")', 
request_options=request_opts2)
     assert result_set.all().result()[0] == 'josh'
-    result_set = client.submit('g.V(z).values("name")', bindings={'z': 5}, 
request_options=request_opts)
+    result_set = client.submit('g.V(z).values("name")', bindings={'z': 5})
     assert result_set.all().result()[0] == 'ripple'
 
 
diff --git 
a/gremlin-python/src/main/python/tests/unit/process/test_strategies.py 
b/gremlin-python/src/main/python/tests/unit/process/test_strategies.py
index 0667f0d19b..324e125e35 100644
--- a/gremlin-python/src/main/python/tests/unit/process/test_strategies.py
+++ b/gremlin-python/src/main/python/tests/unit/process/test_strategies.py
@@ -52,24 +52,21 @@ class TestTraversalStrategies(object):
         ##
         gremlin_script = 
g.without_strategies(ReadOnlyStrategy()).V().gremlin_lang
         gremlin_instr = gremlin_script.gremlin
-        gremlin_params = gremlin_script.parameters
         assert "withStrategies" in str(gremlin_script)
         assert "ReadOnlyStrategy" in str(gremlin_script)
         assert "IncidentToAdjacentStrategy" in str(gremlin_script)
         assert "withoutStrategies" in str(gremlin_script)
         assert "V()" in str(gremlin_script)
         assert "withStrategies(ReadOnlyStrategy,IncidentToAdjacentStrategy)" 
== gremlin_instr[1]
-        assert ReadOnlyStrategy() == gremlin_params["_0"]
+        assert "withoutStrategies(ReadOnlyStrategy)" in str(gremlin_script)
         ##
         gremlin_script = g.without_strategies(ReadOnlyStrategy(), 
LazyBarrierStrategy()).V().gremlin_lang
-        gremlin_params = gremlin_script.parameters
         assert "withStrategies" in str(gremlin_script)
         assert "ReadOnlyStrategy" in str(gremlin_script)
         assert "IncidentToAdjacentStrategy" in str(gremlin_script)
         assert "withoutStrategies" in str(gremlin_script)
         assert "V()" in str(gremlin_script)
-        assert ReadOnlyStrategy() == gremlin_params["_1"]
-        assert LazyBarrierStrategy() == gremlin_params["_2"]
+        assert "withoutStrategies(ReadOnlyStrategy,LazyBarrierStrategy)" in 
str(gremlin_script)
         ###
         g = traversal().with_(None)
         gremlin_script = g.with_("x", "test").with_("y").gremlin_lang

Reply via email to