You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by co...@apache.org on 2026/06/11 00:22:35 UTC

(tinkerpop) 10/15: Add nested child-traversal GValue binding unit tests to Go and Python

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

Cole-Greer pushed a commit to branch GValueFollowupTP4
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 37c5fd0796e9f526bcd5715ec97beb5f34a68b27
Author: Cole Greer <co...@colegreer.ca>
AuthorDate: Tue Jun 9 15:37:09 2026 -0700

    Add nested child-traversal GValue binding unit tests to Go and Python
    
    Adds unit coverage proving a GValue used inside an anonymous/child traversal has its binding merged into the parent GremlinLang's parameters, mirroring the new JavaScript tests.
    
    Assisted-by: Kiro:claude-opus-4.8
---
 gremlin-go/driver/gValue_test.go                          | 15 +++++++++++++++
 .../main/python/tests/unit/process/test_gremlin_lang.py   | 13 +++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/gremlin-go/driver/gValue_test.go b/gremlin-go/driver/gValue_test.go
index 5c0fddfa75..6a014ceb57 100644
--- a/gremlin-go/driver/gValue_test.go
+++ b/gremlin-go/driver/gValue_test.go
@@ -123,4 +123,19 @@ func TestGValue(t *testing.T) {
 		param2 := NewGValue("ids", []int{1, 2, 3})
 		assert.NotPanics(t, func() { g.Inject(param1).V(param2) })
 	})
+
+	t.Run("test gValue nested in child traversal merges bindings", func(t *testing.T) {
+		g := NewGraphTraversalSource(nil, nil)
+		gl := g.V().Where(T__.Is(NewGValue("xx1", 1))).GremlinLang
+		assert.Equal(t, "g.V().where(__.is(xx1))", gl.GetGremlin())
+		assert.Equal(t, 1, gl.parameters["xx1"])
+	})
+
+	t.Run("test gValue nested across multiple child traversals merges bindings", func(t *testing.T) {
+		g := NewGraphTraversalSource(nil, nil)
+		gl := g.V().Union(T__.V(NewGValue("vid1", 1)), T__.V(NewGValue("vid4", 4))).GremlinLang
+		assert.Equal(t, "g.V().union(__.V(vid1),__.V(vid4))", gl.GetGremlin())
+		assert.Equal(t, 1, gl.parameters["vid1"])
+		assert.Equal(t, 4, gl.parameters["vid4"])
+	})
 }
diff --git a/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py b/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
index 473f0ad80f..a733093373 100644
--- a/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
+++ b/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
@@ -546,6 +546,19 @@ class TestGremlinLang(object):
         assert 'g.inject(ids).V(ids)' == gremlin.get_gremlin()
         assert val == gremlin.get_parameters().get('ids')
 
+    def test_gvalue_nested_in_child_traversal(self):
+        g = traversal().with_(None)
+        gremlin = g.V().where(__.is_(GValue('xx1', 1))).gremlin_lang
+        assert 'g.V().where(__.is(xx1))' == gremlin.get_gremlin()
+        assert 1 == gremlin.get_parameters().get('xx1')
+
+    def test_gvalue_nested_across_multiple_child_traversals(self):
+        g = traversal().with_(None)
+        gremlin = g.V().union(__.V(GValue('vid1', 1)), __.V(GValue('vid4', 4))).gremlin_lang
+        assert 'g.V().union(__.V(vid1),__.V(vid4))' == gremlin.get_gremlin()
+        assert 1 == gremlin.get_parameters().get('vid1')
+        assert 4 == gremlin.get_parameters().get('vid4')
+
     def test_gvalue_mid_string_underscore_accepted(self):
         g = traversal().with_(None)
         p = GValue('a_b', 42)