summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-11-30 13:00:43 -0500
committerChris McDonough <chrism@plope.com>2011-11-30 13:00:43 -0500
commit82ba1088e98d6e33136b5e78f87ac02d0daa7879 (patch)
tree45b90af750fc15ad9d977a234df17d07d86c58a0
parent57a0d7765c54031e6ac83881b536712316f22c45 (diff)
downloadpyramid-82ba1088e98d6e33136b5e78f87ac02d0daa7879.tar.gz
pyramid-82ba1088e98d6e33136b5e78f87ac02d0daa7879.tar.bz2
pyramid-82ba1088e98d6e33136b5e78f87ac02d0daa7879.zip
fix set repr on py3
-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, ']')