[Python-checkins] cpython: Issue #12367: Add a test on error attribute of select.error
victor.stinner
python-checkins at python.org
Wed Oct 12 21:01:02 CEST 2011
http://hg.python.org/cpython/rev/8bbfb24d4824
changeset: 72896:8bbfb24d4824
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Oct 12 21:01:46 2011 +0200
summary:
Issue #12367: Add a test on error attribute of select.error
Thanks to the PEP 3151, select.error (which is just an alias to OSError) has
now an error attribute.
files:
Lib/test/test_select.py | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -1,8 +1,9 @@
+import errno
+import os
+import select
+import sys
+import unittest
from test import support
-import unittest
-import select
-import os
-import sys
@unittest.skipIf(sys.platform[:3] in ('win', 'os2', 'riscos'),
"can't easily test on this system")
@@ -22,6 +23,17 @@
self.assertRaises(TypeError, select.select, [], [], [], "not a number")
self.assertRaises(ValueError, select.select, [], [], [], -1)
+ def test_errno(self):
+ with open(__file__, 'rb') as fp:
+ fd = fp.fileno()
+ fp.close()
+ try:
+ select.select([fd], [], [])
+ except select.error as err:
+ self.assertEqual(err.errno, errno.EBADF)
+ else:
+ self.fail("exception not raised")
+
def test_returned_list_identity(self):
# See issue #8329
r, w, x = select.select([], [], [], 1)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list