Commit a9584e19 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[py3] Fix comparison of cardinality when maxc is graph_nodes.INFINITY

`max(maxc, maxvalue)` would evaluate to `max("Infinity", <some
integer>)` when maxc is graph_nodes.INFINITY. While this works on
python2 (by chance, since strings and integers can be compared), this
does not on python3.

We thus move the "if" that checks for graph_nodes.INFINITY inside the
"for" loop.
parent e7bc12390c5d
......@@ -133,9 +133,10 @@ def integrity_cardinality(data_object):
minc, maxc = minmax_cardinality(parent_cardinality)
minvalue = min(minc, minvalue)
maxvalue = max(maxc, maxvalue)
if maxvalue == graph_nodes.INFINITY:
maxvalue = 'n'
if maxc == graph_nodes.INFINITY:
maxvalue = 'n'
maxvalue = max(maxc, maxvalue)
if minvalue == maxvalue == 1:
return '1'
return '{}..{}'.format(minvalue, maxvalue)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment