Fixed side effects checking.

Reviewers: buda

Reviewed By: buda

Subscribers: matej.gradicek

Differential Revision: https://phabricator.memgraph.io/D131
This commit is contained in:
Matej Gradiček 2017-03-15 17:22:08 +00:00
parent b6fe3fc520
commit d8a33fc667
2 changed files with 7 additions and 7 deletions

View File

@ -46,20 +46,20 @@ def add_side_effects(context, counters):
graph_properties = context.graph_properties
#check nodes
if counters.nodes_created > 0:
graph_properties.change_nodes(counters.nodes_created)
if counters.nodes_deleted > 0:
graph_properties.change_nodes(-counters.nodes_deleted)
if counters.nodes_created > 0:
graph_properties.change_nodes(counters.nodes_created)
#check relationships
if counters.relationships_created > 0:
graph_properties.change_relationships(counters.relationships_created)
if counters.relationships_deleted > 0:
graph_properties.change_relationships(-counters.relationships_deleted)
if counters.relationships_created > 0:
graph_properties.change_relationships(counters.relationships_created)
#check labels
if counters.labels_added > 0:
graph_properties.change_labels(counters.labels_added)
if counters.labels_removed > 0:
graph_properties.change_labels(-counters.labels_removed)
if counters.labels_added > 0:
graph_properties.change_labels(counters.labels_added)
#check properties
if counters.properties_set > 0:
graph_properties.change_properties(counters.properties_set)

View File

@ -38,7 +38,6 @@ def parse_props(prop_json):
return ""
properties = "{"
for prop in prop_json:
print (prop + " " + str(prop_json[prop]))
if prop_json[prop] is None:
properties += prop + ": null, "
elif isinstance(prop_json[prop], str):
@ -301,6 +300,7 @@ def side_effects_number(prop, table):
sign = 1
if row[0][1:] == prop:
ret.append(int(row[1])*sign)
ret.sort()
return ret
@then('the side effects should be')