You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/26 18:08:23 UTC
tinkerpop git commit: added test_traversal.py with a method to test
bytecode construction.
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1278 078f76064 -> b8ea0237a
added test_traversal.py with a method to test bytecode construction.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b8ea0237
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b8ea0237
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b8ea0237
Branch: refs/heads/TINKERPOP-1278
Commit: b8ea0237a4d72ffd15e80ab85dbe06b62c14b762
Parents: 078f760
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 26 12:08:19 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 26 12:08:19 2016 -0600
----------------------------------------------------------------------
.../src/main/jython/tests/process/__init__.py | 20 +++++++
.../main/jython/tests/process/test_traversal.py | 57 ++++++++++++++++++++
2 files changed, 77 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b8ea0237/gremlin-python/src/main/jython/tests/process/__init__.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/process/__init__.py b/gremlin-python/src/main/jython/tests/process/__init__.py
new file mode 100644
index 0000000..6df1100
--- /dev/null
+++ b/gremlin-python/src/main/jython/tests/process/__init__.py
@@ -0,0 +1,20 @@
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+'''
+
+__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b8ea0237/gremlin-python/src/main/jython/tests/process/test_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/process/test_traversal.py b/gremlin-python/src/main/jython/tests/process/test_traversal.py
new file mode 100644
index 0000000..1dfd78b
--- /dev/null
+++ b/gremlin-python/src/main/jython/tests/process/test_traversal.py
@@ -0,0 +1,57 @@
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+'''
+
+__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
+
+import unittest
+from unittest import TestCase
+
+from gremlin_python.structure import Graph
+
+
+class TestTraversal(TestCase):
+ def test_bytecode(self):
+ g = Graph().traversal()
+ bytecode = g.V().out("created").bytecode
+ assert 0 == len(bytecode.bindings.keys())
+ assert 0 == len(bytecode.source_instructions)
+ assert 2 == len(bytecode.step_instructions)
+ assert "V" == bytecode.step_instructions[0][0]
+ assert "out" == bytecode.step_instructions[1][0]
+ assert "created" == bytecode.step_instructions[1][1]
+ assert 1 == len(bytecode.step_instructions[0])
+ assert 2 == len(bytecode.step_instructions[1])
+ ##
+ bytecode = g.withSack(1).E().groupCount().by("weight").bytecode
+ assert 0 == len(bytecode.bindings.keys())
+ assert 1 == len(bytecode.source_instructions)
+ assert "withSack" == bytecode.source_instructions[0][0]
+ assert 1 == bytecode.source_instructions[0][1]
+ assert 3 == len(bytecode.step_instructions)
+ assert "E" == bytecode.step_instructions[0][0]
+ assert "groupCount" == bytecode.step_instructions[1][0]
+ assert "by" == bytecode.step_instructions[2][0]
+ assert "weight" == bytecode.step_instructions[2][1]
+ assert 1 == len(bytecode.step_instructions[0])
+ assert 1 == len(bytecode.step_instructions[1])
+ assert 2 == len(bytecode.step_instructions[2])
+
+
+if __name__ == '__main__':
+ unittest.main()