summaryrefslogtreecommitdiff
path: root/test/test-exception-py2.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-exception-py2.py')
-rw-r--r--test/test-exception-py2.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/test-exception-py2.py b/test/test-exception-py2.py
index 98a6cd9..02cf93d 100644
--- a/test/test-exception-py2.py
+++ b/test/test-exception-py2.py
@@ -36,9 +36,8 @@ class DBusExceptionTestCase(unittest.TestCase):
def test_dbus_exception_convert_str_fail(self):
"""Test that a non-ascii Exception fails to convert to str"""
if sys.getdefaultencoding() == 'ascii':
- with self.assertRaises(UnicodeEncodeError):
- e = dbus.exceptions.DBusException(u"bä")
- print str(e)
+ self.assertRaises(UnicodeEncodeError,
+ lambda: str(dbus.exceptions.DBusException(u"bä")))
else:
self.skipTest("you're using a weird non-ascii "
"sys.getdefaultencoding()")