本文整理汇总了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;未经允许,请勿转载。 |
请发表评论