diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-10-16 17:52:36 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-10-16 17:52:36 +0100 |
commit | efdd1823239b02fe5a39e766cbd7597e6c3fcb96 (patch) | |
tree | 138576cd3c6d01b17a08a16d7fbfe06579eeed6d | |
parent | 83615efbed565a689008b00a4ac82fc0fc4e5603 (diff) | |
download | dbus-python-efdd1823239b02fe5a39e766cbd7597e6c3fcb96.tar.gz |
Use a form of assertRaises() that works in Python 2.6
-rw-r--r-- | test/test-exception-py2.py | 5 |
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()") |