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

Unified Diff: Lib/test/test_kqueue.py

Issue 18794: select.devpoll objects have no close() method
Patch Set: Created 6 years, 2 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_kqueue.py Wed Aug 21 13:26:34 2013 +0200
+++ b/Lib/test/test_kqueue.py Wed Aug 21 20:19:00 2013 +0200
@@ -185,6 +185,26 @@ class TestKQueue(unittest.TestCase):
b.close()
kq.close()
+ def test_close(self):
+ open_file = open(__file__, "rb")
+ self.addCleanup(open_file.close)
+ fd = open_file.fileno()
+ obj = select.kqueue()
+
+ # test fileno() method and closed attribute
+ fd = obj.fileno()
+ 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()
+
+
def test_main():
support.run_unittest(TestKQueue)
« Lib/test/test_epoll.py ('K') | « Lib/test/test_epoll.py ('k') | Modules/selectmodule.c » ('j') | no next file with comments »

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