summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyramid/tests/test_util.py5
-rw-r--r--pyramid/util.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/pyramid/tests/test_util.py b/pyramid/tests/test_util.py
index f45c75535..d010e6653 100644
--- a/pyramid/tests/test_util.py
+++ b/pyramid/tests/test_util.py
@@ -279,7 +279,10 @@ class Test_object_description(unittest.TestCase):
self.assertEqual(self._callFUT(('a', 'b')), "('a', 'b')")
def test_set(self):
- self.assertEqual(self._callFUT(set(['a'])), "set(['a'])")
+ if PY3:
+ self.assertEqual(self._callFUT(set(['a'])), "{'a'}")
+ else:
+ self.assertEqual(self._callFUT(set(['a'])), "set(['a'])")
def test_list(self):
self.assertEqual(self._callFUT(['a']), "['a']")
diff --git a/pyramid/util.py b/pyramid/util.py
index 1fd612d09..f22f847c4 100644
--- a/pyramid/util.py
+++ b/pyramid/util.py
@@ -7,6 +7,7 @@ from pyramid.compat import (
integer_types,
string_types,
text_,
+ PY3,
)
from pyramid.exceptions import ConfigurationError
@@ -264,7 +265,12 @@ def object_description(object):
return text_(str(object))
if isinstance(object, (bool, float, type(None))):
return text_(str(object))
- if isinstance(object, (tuple, set)):
+ if isinstance(object, set):
+ if PY3: # pragma: no cover
+ return shortrepr(object, '}')
+ else:
+ return shortrepr(object, ')')
+ if isinstance(object, tuple):
return shortrepr(object, ')')
if isinstance(object, list):
return shortrepr(object, ']')