示例#1
0
文件: __init__.py 项目: bbonf/matcha
    def test_matches(self):
        p = atom()
        full_match(p, 'symbol', Symbol('symbol'))
        full_match(p, '"double_quote"', StringLiteral('"double_quote"'))
        full_match(p, "'single_quote'", StringLiteral("'single_quote'"))
        full_match(p, '1234', NumericLiteral('1234'))
        full_match(p, 'dotted.name', Symbol('dotted.name'))

        full_match(p, 'a', Symbol('a'))
示例#2
0
文件: __init__.py 项目: bbonf/matcha
 def test_fails(self):
     p = atom()
     no_match(p, '{}weird')
     no_match(p, '')
     eq_(p('more than one'), (Symbol('more'), 'than one'))