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

Side by Side Diff: Lib/test/test_epoll.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Lib/test/test_dbm.py ('k') | Lib/test/test_faulthandler.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2001-2006 Twisted Matrix Laboratories. 1 # Copyright (c) 2001-2006 Twisted Matrix Laboratories.
2 # 2 #
3 # Permission is hereby granted, free of charge, to any person obtaining 3 # Permission is hereby granted, free of charge, to any person obtaining
4 # a copy of this software and associated documentation files (the 4 # a copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including 5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish, 6 # without limitation the rights to use, copy, modify, merge, publish,
7 # distribute, sublicense, and/or sell copies of the Software, and to 7 # distribute, sublicense, and/or sell copies of the Software, and to
8 # permit persons to whom the Software is furnished to do so, subject to 8 # permit persons to whom the Software is furnished to do so, subject to
9 # the following conditions: 9 # the following conditions:
10 # 10 #
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 server, addr = self.serverSocket.accept() 63 server, addr = self.serverSocket.accept()
64 64
65 self.connections.extend((client, server)) 65 self.connections.extend((client, server))
66 return client, server 66 return client, server
67 67
68 def test_create(self): 68 def test_create(self):
69 try: 69 try:
70 ep = select.epoll(16) 70 ep = select.epoll(16)
71 except OSError as e: 71 except OSError as e:
72 raise AssertionError(str(e)) 72 raise AssertionError(str(e))
73 self.assertTrue(ep.fileno() > 0, ep.fileno()) 73 self.assertGreater(ep.fileno(), 0)
74 self.assertTrue(not ep.closed) 74 self.assertFalse(ep.closed)
75 ep.close() 75 ep.close()
76 self.assertTrue(ep.closed) 76 self.assertTrue(ep.closed)
77 self.assertRaises(ValueError, ep.fileno) 77 self.assertRaises(ValueError, ep.fileno)
78 if hasattr(select, "EPOLL_CLOEXEC"): 78 if hasattr(select, "EPOLL_CLOEXEC"):
79 select.epoll(select.EPOLL_CLOEXEC).close() 79 select.epoll(select.EPOLL_CLOEXEC).close()
80 self.assertRaises(OSError, select.epoll, flags=12356) 80 self.assertRaises(OSError, select.epoll, flags=12356)
81 81
82 def test_badcreate(self): 82 def test_badcreate(self):
83 self.assertRaises(TypeError, select.epoll, 1, 2, 3) 83 self.assertRaises(TypeError, select.epoll, 1, 2, 3)
84 self.assertRaises(TypeError, select.epoll, 'foo') 84 self.assertRaises(TypeError, select.epoll, 'foo')
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 epoll = select.epoll() 253 epoll = select.epoll()
254 self.addCleanup(epoll.close) 254 self.addCleanup(epoll.close)
255 self.assertEqual(os.get_inheritable(epoll.fileno()), False) 255 self.assertEqual(os.get_inheritable(epoll.fileno()), False)
256 256
257 257
258 def test_main(): 258 def test_main():
259 support.run_unittest(TestEPoll) 259 support.run_unittest(TestEPoll)
260 260
261 if __name__ == "__main__": 261 if __name__ == "__main__":
262 test_main() 262 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_dbm.py ('k') | Lib/test/test_faulthandler.py » ('j') | no next file with comments »

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