test_core.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:inxs 作者: funkyfuture 项目源码 文件源码
def test_subtransformation():
    subtransformation = Transformation(
        Rule('*', lib.set_localname('pablo'))
    )
    transformation = Transformation(
        lib.f(id, Ref('root')), lib.put_variable('source_id'),
        subtransformation,
        lib.f(id, Ref('root')), lib.put_variable('result_id'),
        lib.debug_symbols('source_id', 'result_id'),
        Rule(Not(If(Ref('source_id'), operator.eq, Ref('result_id'))),
             (lib.debug_message('NO!'), lib.debug_symbols('root'),
                 lib.set_localname('neruda'), AbortRule))
    )
    doc = etree.fromstring('<augustus />')
    assert etree.QName(doc).text == 'augustus'

    result = transformation(doc)
    assert result.tag == 'pablo'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号