當前位置: 首頁>>代碼示例>>Python>>正文


Python test_support.make_bad_fd方法代碼示例

本文整理匯總了Python中test.test_support.make_bad_fd方法的典型用法代碼示例。如果您正苦於以下問題:Python test_support.make_bad_fd方法的具體用法?Python test_support.make_bad_fd怎麽用?Python test_support.make_bad_fd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在test.test_support的用法示例。


在下文中一共展示了test_support.make_bad_fd方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_invalid_fd

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
def test_invalid_fd(self):
        fd = test_support.make_bad_fd()
        self.assertRaises(ValueError, signal.set_wakeup_fd, fd) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:5,代碼來源:test_signal.py

示例2: check

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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 an OSError with a bad file descriptor"
                      % f) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_os.py

示例3: test_isatty

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
def test_isatty(self):
        self.assertEqual(os.isatty(test_support.make_bad_fd()), False) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:4,代碼來源:test_os.py

示例4: test_closerange

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:test_os.py

示例5: testInvalidFd

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:IronLanguages,項目名稱:ironpython2,代碼行數:8,代碼來源:test_fileio.py

示例6: check

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:dxwu,項目名稱:BinderFilter,代碼行數:10,代碼來源:test_os.py

示例7: test_isatty

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
def test_isatty(self):
        if hasattr(os, "isatty"):
            self.assertEqual(os.isatty(test_support.make_bad_fd()), False) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:5,代碼來源:test_os.py

示例8: test_closerange

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:
                raise unittest.SkipTest(
                    "Unable to acquire a range of invalid file descriptors")
            self.assertEqual(os.closerange(fd, fd + i-1), None) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:17,代碼來源:test_os.py

示例9: testInvalidFd

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:dxwu,項目名稱:BinderFilter,代碼行數:11,代碼來源:test_fileio.py

示例10: check

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:Acmesec,項目名稱:CTFCrackTools-V2,代碼行數:13,代碼來源:test_os.py

示例11: test_closerange

# 需要導入模塊: from test import test_support [as 別名]
# 或者: from test.test_support import make_bad_fd [as 別名]
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:Acmesec,項目名稱:CTFCrackTools-V2,代碼行數:17,代碼來源:test_os.py


注:本文中的test.test_support.make_bad_fd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。