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

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

Issue 16510: Using appropriate checks in tests
Patch Set: Created 6 years, 4 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_email/test_utils.py ('k') | Lib/test/test_exceptions.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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 self.assertFalse(then - now > 0.01) 223 self.assertFalse(then - now > 0.01)
224 224
225 server.close() 225 server.close()
226 ep.unregister(fd) 226 ep.unregister(fd)
227 227
228 def test_main(): 228 def test_main():
229 support.run_unittest(TestEPoll) 229 support.run_unittest(TestEPoll)
230 230
231 if __name__ == "__main__": 231 if __name__ == "__main__":
232 test_main() 232 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_email/test_utils.py ('k') | Lib/test/test_exceptions.py » ('j') | no next file with comments »

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