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


Python _testcapi.USHRT_MAX屬性代碼示例

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


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

示例1: test_poll3

# 需要導入模塊: import _testcapi [as 別名]
# 或者: from _testcapi import USHRT_MAX [as 別名]
def test_poll3(self):
        # test int overflow
        pollster = select.poll()
        pollster.register(1)

        self.assertRaises(OverflowError, pollster.poll, 1L << 64)

        x = 2 + 3
        if x != 5:
            self.fail('Overflow must have occurred')

        pollster = select.poll()
        # Issue 15989
        self.assertRaises(OverflowError, pollster.register, 0,
                          _testcapi.SHRT_MAX + 1)
        self.assertRaises(OverflowError, pollster.register, 0,
                          _testcapi.USHRT_MAX + 1)
        self.assertRaises(OverflowError, pollster.poll, _testcapi.INT_MAX + 1)
        self.assertRaises(OverflowError, pollster.poll, _testcapi.UINT_MAX + 1) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:21,代碼來源:test_poll.py

示例2: test_poll_c_limits

# 需要導入模塊: import _testcapi [as 別名]
# 或者: from _testcapi import USHRT_MAX [as 別名]
def test_poll_c_limits(self):
        from _testcapi import USHRT_MAX, INT_MAX, UINT_MAX
        pollster = select.poll()
        pollster.register(1)

        # Issues #15989, #17919
        self.assertRaises(OverflowError, pollster.register, 0, USHRT_MAX + 1)
        self.assertRaises(OverflowError, pollster.modify, 1, USHRT_MAX + 1)
        self.assertRaises(OverflowError, pollster.poll, INT_MAX + 1)
        self.assertRaises(OverflowError, pollster.poll, UINT_MAX + 1) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:12,代碼來源:test_poll.py

示例3: test_events_mask_overflow_c_limits

# 需要導入模塊: import _testcapi [as 別名]
# 或者: from _testcapi import USHRT_MAX [as 別名]
def test_events_mask_overflow_c_limits(self):
        from _testcapi import USHRT_MAX
        pollster = select.devpoll()
        w, r = os.pipe()
        pollster.register(w)
        # Issue #17919
        self.assertRaises(OverflowError, pollster.register, 0, USHRT_MAX + 1)
        self.assertRaises(OverflowError, pollster.modify, 1, USHRT_MAX + 1) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:10,代碼來源:test_devpoll.py


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