Commits

Dusty Phillips  committed e1fee15

Test case for failing 2.7.4 stdlib poll.

Test ported from stdlib unittest to py.test. I was unable to find a solution in
the time I had as I can't find where the relevant constants would be explained in
Pypy

  • Participants
  • Parent commits 3725099
  • Branches stdlib-2.7.4

Comments (0)

Files changed (1)

File pypy/module/select/test/test_select.py

         thread.start_new_thread(s2.connect, (self.sockaddress,))
         s1, addr2 = self.sock.accept()
 
-        return s1, s2
+    def test_poll3(self):  # Adapted from 2.7/test/test_poll.py
+        import _testcapi
+        import select
+        # test int overflow
+        pollster = select.poll()
+        pollster.register(1)
+
+        with py.test.raises(OverflowError):
+            pollster.poll(1L << 64)
+
+        x = 2 + 3
+        assert x == 5, 'Overflow must have occurred'
+
+        pollster = select.poll()
+        # Issue 15989
+        with py.test.raises(OverflowError):
+            pollster.register(0, _testcapi.SHRT_MAX + 1)
+        with py.test.raises(OverflowError):
+            pollster.register(0, _testcapi.SHRT_MAX + 1)
+        with py.test.raises(OverflowError):
+            pollster.register(0, _testcapi.USHRT_MAX + 1)
+        with py.test.raises(OverflowError):
+            pollster.poll(_testcapi.INT_MAX + 1)
+        with py.test.raises(OverflowError):
+            pollster.poll(_testcapi.UINT_MAX + 1)