本文整理匯總了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