From 8c4f97f0ace95b32e0c1e202f4570706c8433fd8 Mon Sep 17 00:00:00 2001 From: swilly22 <roi@redislabs.com> Date: Mon, 28 Dec 2020 13:58:31 +0200 Subject: [PATCH] edge ctor validation should check for none args --- redisgraph/edge.py | 2 +- tests/functional/test_all.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/redisgraph/edge.py b/redisgraph/edge.py index f2a80c1..8d0d2cd 100644 --- a/redisgraph/edge.py +++ b/redisgraph/edge.py @@ -12,7 +12,7 @@ def __init__(self, src_node, relation, dest_node, edge_id=None, """ Create a new edge. """ - if not (src_node and dest_node): + if (src_node is None or dest_node is None): # NOTE(bors-42): It makes sense to change AssertionError to # ValueError here raise AssertionError("Both src_node & dest_node must be provided") diff --git a/tests/functional/test_all.py b/tests/functional/test_all.py index c7006f8..9a5de84 100644 --- a/tests/functional/test_all.py +++ b/tests/functional/test_all.py @@ -49,7 +49,7 @@ def test_graph_creation(self): def test_array_functions(self): redis_graph = Graph('social', self.r) - query = """CREATE (p:person{name:'a',age:32, array:[0,1,2]})""" + query = """CREATE (p:person{name:'a', age:32, array:[0,1,2]})""" redis_graph.query(query) query = """WITH [0,1,2] as x return x""" @@ -163,7 +163,6 @@ def test_optional_match(self): # Build a graph of form (a)-[R]->(b) node0 = Node(node_id=0, label="L1", properties={'value': 'a'}) node1 = Node(node_id=1, label="L1", properties={'value': 'b'}) - edge01 = Edge(node0, "R", node1, edge_id=0) redis_graph.add_node(node0) @@ -233,6 +232,8 @@ def test_query_timeout(self): # Expecting an error. pass + redis_graph.delete() + def test_read_only_query(self): redis_graph = Graph('read_only', self.r) @@ -313,6 +314,8 @@ def test_cache_sync(self): assert(A._relationshipTypes[0] == 'S') assert(A._relationshipTypes[1] == 'R') + A.delete() + if __name__ == '__main__': unittest.main()