diff options
Diffstat (limited to 'tests/test_util_inspect.py')
-rw-r--r-- | tests/test_util_inspect.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py index 6a3e25b6e..0c7c7667d 100644 --- a/tests/test_util_inspect.py +++ b/tests/test_util_inspect.py @@ -346,6 +346,24 @@ def test_dictionary_sorting(): assert description == "{'a': 1, 'b': 4, 'c': 3, 'd': 2}" +def test_set_sorting(): + set_ = set("gfedcba") + description = inspect.object_description(set_) + if PY3: + assert description == "{'a', 'b', 'c', 'd', 'e', 'f', 'g'}" + else: + assert description == "set(['a', 'b', 'c', 'd', 'e', 'f', 'g'])" + + +def test_set_sorting_fallback(): + set_ = set((None, 1)) + description = inspect.object_description(set_) + if PY3: + assert description in ("{1, None}", "{None, 1}") + else: + assert description in ("set([1, None])", "set([None, 1])") + + def test_dict_customtype(): class CustomType(object): def __init__(self, value): |