diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-12 19:01:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-12 19:01:46 (GMT) |
commit | 21d29c377baa305c04d918cc490220836b434adb (patch) | |
tree | 2d6497bd54695597977f92c5024815da65a56088 /Lib | |
parent | a1bf2984541056449ed86256b2214a1930665657 (diff) | |
download | cpython-21d29c377baa305c04d918cc490220836b434adb.zip cpython-21d29c377baa305c04d918cc490220836b434adb.tar.gz cpython-21d29c377baa305c04d918cc490220836b434adb.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_select.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py index 4a13ade..c503440 100644 --- a/Lib/test/test_select.py +++ b/Lib/test/test_select.py @@ -1,8 +1,9 @@ -from test import support -import unittest -import select +import errno import os +import select import sys +import unittest +from test import support @unittest.skipIf(sys.platform[:3] in ('win', 'os2', 'riscos'), "can't easily test on this system") @@ -22,6 +23,17 @@ class SelectTestCase(unittest.TestCase): 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) |