• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python test_support.make_bad_fd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test.test_support.make_bad_fd函数的典型用法代码示例。如果您正苦于以下问题:Python make_bad_fd函数的具体用法?Python make_bad_fd怎么用?Python make_bad_fd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了make_bad_fd函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testInvalidFd

 def testInvalidFd(self):
     self.assertRaises(ValueError, _FileIO, -10)
     self.assertRaises(OSError, _FileIO, make_bad_fd())
     if sys.platform == 'win32':
         raise unittest.SkipTest('Set _invalid_parameter_handler for low level io')
         import msvcrt
         self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
开发者ID:MichaelBlume,项目名称:pypy,代码行数:7,代码来源:test_fileio.py


示例2: testInvalidFd

 def testInvalidFd(self):
     self.assertRaises(ValueError, _FileIO, -10)
     self.assertRaises(OSError, _FileIO, make_bad_fd())
     if sys.platform == 'win32':
         import msvcrt
         self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
     # Issue 15989
     self.assertRaises(TypeError, _FileIO, _testcapi.INT_MAX + 1)
     self.assertRaises(TypeError, _FileIO, _testcapi.INT_MIN - 1)
开发者ID:Zekom,项目名称:pypyjs,代码行数:9,代码来源:test_fileio.py


示例3: testInvalidFd

 def testInvalidFd(self):
     if is_jython:
         self.assertRaises(TypeError, _FileIO, -10)  # file descriptor not int in Jython
     else:
         self.assertRaises(ValueError, _FileIO, -10)
     self.assertRaises(OSError, _FileIO, make_bad_fd())
     if sys.platform == 'win32':
         import msvcrt
         self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
开发者ID:Britefury,项目名称:jython,代码行数:9,代码来源:test_fileio.py


示例4: check

 def check(self, f, *args):
     try:
         f(test_support.make_bad_fd(), *args)
     except OSError as e:
         self.assertEqual(e.errno, errno.EBADF)
     else:
         self.fail("%r didn't raise a OSError with a bad file descriptor" % f)
开发者ID:van7hu,项目名称:fanca,代码行数:7,代码来源:test_os.py


示例5: check

 def check(self, f, *args):
     try:
         fd = test_support.make_bad_fd()
         f(fd, *args)
     except OSError as e:
         self.assertEqual(e.errno, errno.EBADF)
     except ValueError:
         self.assertTrue(test_support.is_jython)
     else:
         self.fail("%r didn't raise a OSError with a bad file descriptor"
                   % f)
开发者ID:EnviroCentre,项目名称:jython-upgrade,代码行数:11,代码来源:test_os.py


示例6: test_closerange

 def test_closerange(self):
     fd = test_support.make_bad_fd()
     # Make sure none of the descriptors we are about to close are
     # currently valid (issue 6542).
     for i in range(10):
         try: os.fstat(fd+i)
         except OSError:
             pass
         else:
             break
     if i < 2:
         raise unittest.SkipTest(
             "Unable to acquire a range of invalid file descriptors")
     self.assertEqual(os.closerange(fd, fd + i-1), None)
开发者ID:RDWang,项目名称:python,代码行数:14,代码来源:test_os.py


示例7: test_closerange

 def test_closerange(self):
     if hasattr(os, "closerange"):
         fd = int(test_support.make_bad_fd())  # need to take an int for Jython, given this test
         # Make sure none of the descriptors we are about to close are
         # currently valid (issue 6542).
         for i in range(10):
             try: os.fstat(fd+i)
             except OSError:
                 pass
             else:
                 break
         if i < 2:
             raise unittest.SkipTest(
                 "Unable to acquire a range of invalid file descriptors")
         self.assertEqual(os.closerange(fd, fd + i-1), None)
开发者ID:EnviroCentre,项目名称:jython-upgrade,代码行数:15,代码来源:test_os.py


示例8: test_closerange

 def test_closerange(self):
     if hasattr(os, "closerange"):
         fd = test_support.make_bad_fd()
         # Make sure none of the descriptors we are about to close are
         # currently valid (issue 6542).
         for i in range(10):
             try: os.fstat(fd+i)
             except OSError:
                 pass
             else:
                 break
         if i < 2:
             # Unable to acquire a range of invalid file descriptors,
             # so skip the test (in 2.6+ this is a unittest.SkipTest).
             return
         self.assertEqual(os.closerange(fd, fd + i-1), None)
开发者ID:tczf1128,项目名称:zk,代码行数:16,代码来源:test_os.py


示例9: test_isatty

 def test_isatty(self):
     self.assertEqual(os.isatty(test_support.make_bad_fd()), False)
开发者ID:RDWang,项目名称:python,代码行数:2,代码来源:test_os.py


示例10: test_ftruncate

 def test_ftruncate(self):
     if hasattr(os, "ftruncate"):
         self.assertRaises(IOError, os.ftruncate, test_support.make_bad_fd(),
                           0)
开发者ID:tczf1128,项目名称:zk,代码行数:4,代码来源:test_os.py


示例11: check

 def check(self, f, *args):
     self.assertRaises(OSError, f, test_support.make_bad_fd(), *args)
开发者ID:tczf1128,项目名称:zk,代码行数:2,代码来源:test_os.py


示例12: test_invalid_fd

 def test_invalid_fd(self):
     fd = test_support.make_bad_fd()
     self.assertRaises(ValueError, signal.set_wakeup_fd, fd)
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:3,代码来源:test_signal.py


示例13: testInvalidFd

 def testInvalidFd(self):
     self.assertRaises(ValueError, _fileio._FileIO, -10)
     self.assertRaises(OSError, _fileio._FileIO, make_bad_fd())
开发者ID:Vignesh2736,项目名称:IncPy,代码行数:3,代码来源:test_fileio.py


示例14: testInvalidFd

 def testInvalidFd(self):
     self.assertRaises(ValueError, _FileIO, -10)
     self.assertRaises(OSError, _FileIO, make_bad_fd())
     if sys.platform == 'win32':
         import msvcrt
         self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd())
开发者ID:carriercomm,项目名称:gentoo,代码行数:6,代码来源:test_fileio.py


示例15: test_closerange

 def test_closerange(self):
     if hasattr(os, "closerange"):
         fd = test_support.make_bad_fd()
         self.assertEqual(os.closerange(fd, fd + 10), None)
开发者ID:mullens,项目名称:khk-lights,代码行数:4,代码来源:test_os.py


示例16: testInvalidFd

 def testInvalidFd(self):  # replaces that of the stdlib
     self.assertRaises(ValueError, io.open, -10, 'wb', buffering=0, )
     bad_fd = test_support.make_bad_fd()
     self.assertRaises(IOError, io.open, bad_fd, 'wb', buffering=0)
开发者ID:pakal,项目名称:rsfile,代码行数:4,代码来源:test_rsfile_streams.py



注:本文中的test.test_support.make_bad_fd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_support.reap_children函数代码示例发布时间:2022-05-27
下一篇:
Python test_support.is_resource_enabled函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap