From 05f4f2e7423f60c22f62e6337adce18e4fff5a11 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Jul 2017 09:47:52 +0200 Subject: [PATCH] Fix TestDict.test_hypothesis_text for unordered dicts --- tests/unit/config/test_configtypes.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 4756e657d..cafaffb98 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -1471,10 +1471,13 @@ class TestDict: try: converted = d.from_str(text) except configexc.ValidationError: - pass - else: - expected = '' if not val else text - assert d.to_str(converted) == expected + return + + if len(converted) > 1: + # For longer dicts, the key order could be switched + return + + assert d.to_str(converted) == '' if not val else text def unrequired_class(**kwargs):