当前位置: 首页>>代码示例>>Python>>正文


Python IPy._checkPrefix方法代码示例

本文整理汇总了Python中IPy._checkPrefix方法的典型用法代码示例。如果您正苦于以下问题:Python IPy._checkPrefix方法的具体用法?Python IPy._checkPrefix怎么用?Python IPy._checkPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPy的用法示例。


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

示例1: testCheckPrefixFail

# 需要导入模块: import IPy [as 别名]
# 或者: from IPy import _checkPrefix [as 别名]
 def testCheckPrefixFail(self):
     """Illegal Prefixes should be catched."""
     self.failIf(IPy._checkPrefix(0x7F000001L, -1, 4))
     self.failIf(IPy._checkPrefix(0x7F000001L, 33, 4))
     self.failIf(IPy._checkPrefix(0x7F000001L, 24, 4))
     self.failIf(IPy._checkPrefix(0x7F000001L, 31, 4))
     self.failIf(IPy._checkPrefix(0x7F000080L, 24, 4))
     self.failIf(IPy._checkPrefix(0x7F000100L, 23, 4))
     self.failIf(IPy._checkPrefix(0x7F000000L, 1, 4))
     self.failIf(IPy._checkPrefix(0x7F000000L, 0, 4))
     self.failIf(IPy._checkPrefix(0x1L, -1, 6))
     self.failIf(IPy._checkPrefix(0x1L, 129, 6))
     self.failIf(IPy._checkPrefix(0xFFFFFFFFFFFFFFFF0000000000000001L, 64, 6))
     self.failIf(IPy._checkPrefix(0xFFFFFFFFFFFFFFFF1000000000000000L, 64, 6))
开发者ID:ingenarius,项目名称:ipall,代码行数:16,代码来源:test_IPy.py

示例2: testCheckPrefixFail

# 需要导入模块: import IPy [as 别名]
# 或者: from IPy import _checkPrefix [as 别名]
 def testCheckPrefixFail(self):
     """Illegal Prefixes should be catched."""
     self.assertFalse(IPy._checkPrefix(0x7f000001, -1, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000001, 33, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000001, 24, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000001, 31, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000080, 24, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000100, 23, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000000, 1, 4))
     self.assertFalse(IPy._checkPrefix(0x7f000000, 0, 4))
     self.assertFalse(IPy._checkPrefix(0x1, -1, 6))
     self.assertFalse(IPy._checkPrefix(0x1, 129, 6))
     self.assertFalse(IPy._checkPrefix(0xffffffffffffffff0000000000000001, 64, 6))
     self.assertFalse(IPy._checkPrefix(0xffffffffffffffff1000000000000000, 64, 6))
开发者ID:LTD-Beget,项目名称:python-ipy,代码行数:16,代码来源:test_IPy.py

示例3: testCheckPrefixOk

# 需要导入模块: import IPy [as 别名]
# 或者: from IPy import _checkPrefix [as 别名]
 def testCheckPrefixOk(self):
     """Legal IP/prefix combinations should check ok."""
     self.failUnless(IPy._checkPrefix(0x0, 32, 4))
     self.failUnless(IPy._checkPrefix(0xFFFFFFFFL, 32, 4))
     self.failUnless(IPy._checkPrefix(0x7F000001L, 32, 4))
     self.failUnless(IPy._checkPrefix(0x80000000L, 1, 4))
     self.failUnless(IPy._checkPrefix(0x40000000L, 2, 4))
     self.failUnless(IPy._checkPrefix(0x80000000L, 3, 4))
     self.failUnless(IPy._checkPrefix(0x80000000L, 4, 4))
     self.failUnless(IPy._checkPrefix(0xFFFFFF00L, 24, 4))
     self.failUnless(IPy._checkPrefix(0xFFFFFF00L, 24, 4))
     self.failUnless(IPy._checkPrefix(0xFFFFFFF0L, 28, 4))
     self.failUnless(IPy._checkPrefix(0x0, 32, 4))
     self.failUnless(IPy._checkPrefix(0x0, 1, 4))
     self.failUnless(IPy._checkPrefix(0x0, 0, 4))
     self.failUnless(IPy._checkPrefix(0xFFFFFFFFFFFFFFFF0000000000000000L, 64, 6))
     self.failUnless(IPy._checkPrefix(0x0L, 64, 6))
     self.failUnless(IPy._checkPrefix(0x0L, 0, 6))
     self.failUnless(IPy._checkPrefix(0x0L, 128, 6))
     self.failUnless(IPy._checkPrefix(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL, 128, 6))
开发者ID:ingenarius,项目名称:ipall,代码行数:22,代码来源:test_IPy.py

示例4: testCheckPrefixOk

# 需要导入模块: import IPy [as 别名]
# 或者: from IPy import _checkPrefix [as 别名]
 def testCheckPrefixOk(self):
     """Legal IP/prefix combinations should check ok."""
     self.assertTrue(IPy._checkPrefix(0x0, 32, 4))
     self.assertTrue(IPy._checkPrefix(0xffffffff, 32, 4))
     self.assertTrue(IPy._checkPrefix(0x7f000001, 32, 4))
     self.assertTrue(IPy._checkPrefix(0x80000000, 1, 4))
     self.assertTrue(IPy._checkPrefix(0x40000000, 2, 4))
     self.assertTrue(IPy._checkPrefix(0x80000000, 3, 4))
     self.assertTrue(IPy._checkPrefix(0x80000000, 4, 4))
     self.assertTrue(IPy._checkPrefix(0xffffff00, 24, 4))
     self.assertTrue(IPy._checkPrefix(0xffffff00, 24, 4))
     self.assertTrue(IPy._checkPrefix(0xfffffff0, 28, 4))
     self.assertTrue(IPy._checkPrefix(0x0, 32, 4))
     self.assertTrue(IPy._checkPrefix(0x0, 1, 4))
     self.assertTrue(IPy._checkPrefix(0x0, 0, 4))
     self.assertTrue(IPy._checkPrefix(0xffffffffffffffff0000000000000000, 64, 6))
     self.assertTrue(IPy._checkPrefix(0x0, 64, 6))
     self.assertTrue(IPy._checkPrefix(0x0, 0, 6))
     self.assertTrue(IPy._checkPrefix(0x0, 128, 6))
     self.assertTrue(IPy._checkPrefix(0xffffffffffffffffffffffffffffffff, 128, 6))
开发者ID:LTD-Beget,项目名称:python-ipy,代码行数:22,代码来源:test_IPy.py


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