raise an OSError for invalid fds #4991
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index d8cf415..c089608 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -176,6 +176,10 @@
         f.close()
         os.unlink(TESTFN)
 
+    def testInvalidFd(self):
+        self.assertRaises(ValueError, _fileio._FileIO, -10)
+        self.assertRaises(OSError, _fileio._FileIO, 10)
+
     def testBadModeArgument(self):
         # verify that we get a sensible error message for bad mode argument
         bad_mode = "qwerty"