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

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

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 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_itertools.py ('k') | Lib/test/test_locale.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 """ 1 """
2 Tests for kqueue wrapper. 2 Tests for kqueue wrapper.
3 """ 3 """
4 import socket
4 import errno 5 import errno
5 import os 6 import time
6 import select 7 import select
7 import socket
8 import sys 8 import sys
9 import time
10 import unittest 9 import unittest
11 10
12 from test import support 11 from test import support
13 if not hasattr(select, "kqueue"): 12 if not hasattr(select, "kqueue"):
14 raise unittest.SkipTest("test works only on BSD") 13 raise unittest.SkipTest("test works only on BSD")
15 14
16 class TestKQueue(unittest.TestCase): 15 class TestKQueue(unittest.TestCase):
17 def test_create_queue(self): 16 def test_create_queue(self):
18 kq = select.kqueue() 17 kq = select.kqueue()
19 self.assertTrue(kq.fileno() > 0, kq.fileno()) 18 self.assertTrue(kq.fileno() > 0, kq.fileno())
20 self.assertTrue(not kq.closed) 19 self.assertTrue(not kq.closed)
21 kq.close() 20 kq.close()
22 self.assertTrue(kq.closed) 21 self.assertTrue(kq.closed)
23 self.assertRaises(ValueError, kq.fileno) 22 self.assertRaises(ValueError, kq.fileno)
24 23
25 def test_create_event(self): 24 def test_create_event(self):
26 from operator import lt, le, gt, ge 25 from operator import lt, le, gt, ge
27 26 fd = sys.stderr.fileno()
28 fd = os.open(os.devnull, os.O_WRONLY)
29 self.addCleanup(os.close, fd)
30
31 ev = select.kevent(fd) 27 ev = select.kevent(fd)
32 other = select.kevent(1000) 28 other = select.kevent(1000)
33 self.assertEqual(ev.ident, fd) 29 self.assertEqual(ev.ident, fd)
34 self.assertEqual(ev.filter, select.KQ_FILTER_READ) 30 self.assertEqual(ev.filter, select.KQ_FILTER_READ)
35 self.assertEqual(ev.flags, select.KQ_EV_ADD) 31 self.assertEqual(ev.flags, select.KQ_EV_ADD)
36 self.assertEqual(ev.fflags, 0) 32 self.assertEqual(ev.fflags, 0)
37 self.assertEqual(ev.data, 0) 33 self.assertEqual(ev.data, 0)
38 self.assertEqual(ev.udata, 0) 34 self.assertEqual(ev.udata, 0)
39 self.assertEqual(ev, ev) 35 self.assertEqual(ev, ev)
40 self.assertNotEqual(ev, other) 36 self.assertNotEqual(ev, other)
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 188
193 a.close() 189 a.close()
194 b.close() 190 b.close()
195 kq.close() 191 kq.close()
196 192
197 def test_main(): 193 def test_main():
198 support.run_unittest(TestKQueue) 194 support.run_unittest(TestKQueue)
199 195
200 if __name__ == "__main__": 196 if __name__ == "__main__":
201 test_main() 197 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_itertools.py ('k') | Lib/test/test_locale.py » ('j') | no next file with comments »

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