Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(119537)

Unified Diff: Lib/test/test_devpoll.py

Issue 18794: select.devpoll objects have no close() method
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Lib/test/test_devpoll.py Wed Aug 21 13:26:34 2013 +0200
+++ b/Lib/test/test_devpoll.py Wed Aug 21 20:19:00 2013 +0200
@@ -87,6 +87,32 @@ class DevPollTests(unittest.TestCase):
self.assertRaises(OverflowError, pollster.poll, 1 << 63)
self.assertRaises(OverflowError, pollster.poll, 1 << 64)
+ def test_close(self):
+ open_file = open(__file__, "rb")
+ self.addCleanup(open_file.close)
+ fd = open_file.fileno()
+ obj = select.devpoll()
+
+ # test fileno() method and closed attribute
+ fd = obj.fileno()
Charles-François Natali 2013/08/21 20:42:15 You're redefining 'fd' defined above: this shouldn
+ self.assertIsInstance(fd, int)
+ self.assertFalse(obj.closed)
+
+ # test close()
+ obj.close()
+ self.assertTrue(obj.closed)
+ self.assertRaises(ValueError, obj.fileno)
+
+ # close() can be called more than once
+ obj.close()
+
+ # operations must fail with ValueError("I/O operation on closed ...")
+ self.assertRaises(ValueError, obj.modify, fd)
+ self.assertRaises(ValueError, obj.poll, 1.0)
+ self.assertRaises(ValueError, obj.register, fd, fd, select.POLLIN)
Charles-François Natali 2013/08/21 20:42:15 devpoll.register() has only two arguments, no?
+ self.assertRaises(ValueError, obj.unregister, fd)
+
+
def test_main():
run_unittest(DevPollTests)
« no previous file with comments | « Doc/library/select.rst ('k') | Lib/test/test_epoll.py » ('j') | Lib/test/test_epoll.py » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+