Skip to content

Commit bca9862

Browse files
committed
Fix dict ordering failures in comparison
With python3 and py.test we run with random hash seeds. This causes some failures in the test suite because we go deeper into some XML trees that we expected and run into even deeper inequalities. AFAICT, this simply makes comparisons return False when they would normally do so.
1 parent 9d901af commit bca9862

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/saml2/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,14 @@ def __eq__(self, other):
827827
return False
828828
elif isinstance(svals, list):
829829
for sval in svals:
830-
for oval in ovals:
831-
if sval == oval:
832-
break
833-
else:
830+
try:
831+
for oval in ovals:
832+
if sval == oval:
833+
break
834+
else:
835+
return False
836+
except TypeError:
837+
# ovals isn't iterable
834838
return False
835839
else:
836840
if svals == ovals: # Since I only support '=='

0 commit comments

Comments
 (0)