From 7a90515d49f495cae5b430dc252286d429322c34 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sun, 28 Apr 2013 20:59:10 +0100 Subject: [PATCH] Treat frozenset as a set Thanks to Brianna Laugher. --- _pytest/assertion/util.py | 2 +- testing/test_assertion.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_pytest/assertion/util.py b/_pytest/assertion/util.py index 0d428e47c..a0cff6b18 100644 --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -94,7 +94,7 @@ def assertrepr_compare(config, op, left, right): issequence = lambda x: isinstance(x, (list, tuple)) istext = lambda x: isinstance(x, basestring) isdict = lambda x: isinstance(x, dict) - isset = lambda x: isinstance(x, set) + isset = lambda x: isinstance(x, (set, frozenset)) verbose = config.getoption('verbose') explanation = None diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 42c66e372..c85bec336 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -99,6 +99,11 @@ class TestAssert_reprcompare: expl = callequal(set([0, 1]), set([0, 2])) assert len(expl) > 1 + def test_frozenzet(self): + expl = callequal(frozenset([0, 1]), set([0, 2])) + print expl + assert len(expl) > 1 + def test_list_tuples(self): expl = callequal([], [(1,2)]) assert len(expl) > 1