summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-10-27 18:31:36 (GMT)
committerThomas Heller <theller@ctypes.org>2006-10-27 18:31:36 (GMT)
commitdf08f0b9a0a3de196336b6b4f158fa2325d08479 (patch)
tree5a8ec68d0f1bb633c58939c64e51381d991f66f5 /Lib/test/test_exceptions.py
parent9627ce116f36ee3d68adcc2cbb8450693198212b (diff)
downloadcpython-df08f0b9a0a3de196336b6b4f158fa2325d08479.zip
cpython-df08f0b9a0a3de196336b6b4f158fa2325d08479.tar.gz
cpython-df08f0b9a0a3de196336b6b4f158fa2325d08479.tar.bz2
WindowsError.str should display the windows error code,
not the posix error code; with test. Fixes #1576174. Will backport to release25-maint.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 585d6fe..79fcee3 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -183,6 +183,19 @@ class ExceptionTests(unittest.TestCase):
test_capi1()
test_capi2()
+ def test_WindowsError(self):
+ try:
+ WindowsError
+ except NameError:
+ pass
+ else:
+ self.failUnlessEqual(str(WindowsError(1001)),
+ "1001")
+ self.failUnlessEqual(str(WindowsError(1001, "message")),
+ "[Error 1001] message")
+ self.failUnlessEqual(WindowsError(1001, "message").errno, 22)
+ self.failUnlessEqual(WindowsError(1001, "message").winerror, 1001)
+
def testAttributes(self):
# test that exception attributes are happy