本文整理汇总了Python中Naked.toolshed.types.XList.wildcard_match方法的典型用法代码示例。如果您正苦于以下问题:Python XList.wildcard_match方法的具体用法?Python XList.wildcard_match怎么用?Python XList.wildcard_match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Naked.toolshed.types.XList
的用法示例。
在下文中一共展示了XList.wildcard_match方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_xlist_wildcard_match
# 需要导入模块: from Naked.toolshed.types import XList [as 别名]
# 或者: from Naked.toolshed.types.XList import wildcard_match [as 别名]
def test_xlist_wildcard_match(self):
xl = XList(['MANY', 'many', 'Many'], {'first_attr': 1})
nl = xl.wildcard_match('m*')
self.assertTrue(len(nl) == 1)
self.assertEqual(nl[0], 'many')
示例2: test_xlist_wildcard_match_nomatches
# 需要导入模块: from Naked.toolshed.types import XList [as 别名]
# 或者: from Naked.toolshed.types.XList import wildcard_match [as 别名]
def test_xlist_wildcard_match_nomatches(self):
xl = XList(['MANY', 'many', 'Many'], {'first_attr': 1})
nl = xl.wildcard_match('t*')
self.assertTrue(len(nl) == 0)
示例3: test_xlist_wildcard_match_nonstring
# 需要导入模块: from Naked.toolshed.types import XList [as 别名]
# 或者: from Naked.toolshed.types.XList import wildcard_match [as 别名]
def test_xlist_wildcard_match_nonstring(self):
xl = XList(['MANY', 1, 'many'], {'first_attr': 1})
with self.assertRaises(TypeError):
nl = xl.wildcard_match('m*') # when the list contains non-string types, TypeError is raised