From efdd1823239b02fe5a39e766cbd7597e6c3fcb96 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 16 Oct 2012 17:52:36 +0100 Subject: Use a form of assertRaises() that works in Python 2.6 --- test/test-exception-py2.py | 5 ++--- 1 file 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()") -- cgit v1.2.1