本文整理汇总了Python中pymeta.runtime.OMetaBase.rule_anything方法的典型用法代码示例。如果您正苦于以下问题:Python OMetaBase.rule_anything方法的具体用法?Python OMetaBase.rule_anything怎么用?Python OMetaBase.rule_anything使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymeta.runtime.OMetaBase
的用法示例。
在下文中一共展示了OMetaBase.rule_anything方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_anything
# 需要导入模块: from pymeta.runtime import OMetaBase [as 别名]
# 或者: from pymeta.runtime.OMetaBase import rule_anything [as 别名]
def test_anything(self):
"""
L{OMetaBase.rule_anything} returns each item from the input along with its position.
"""
data = "foo"
o = OMetaBase(data)
for i, c in enumerate(data):
v, e = o.rule_anything()
self.assertEqual((c, i), (v, e[0]))
示例2: test_anything
# 需要导入模块: from pymeta.runtime import OMetaBase [as 别名]
# 或者: from pymeta.runtime.OMetaBase import rule_anything [as 别名]
def test_anything(self):
"""
L{OMetaBase.rule_anything} returns each item from the input along with its position.
"""
#TODO test more unicode chars
data = u"[email protected]£©™☺☹℅☐☑☒✓❍❖⁰¹²³⁴₀₁₂₃★☆€¥¢!¡?¿–_—·•%‰‱˚˛"
o = OMetaBase(data)
for i, c in enumerate(data):
v, e = o.rule_anything()
self.assertEqual((c, i), (v, e[0]))