示例#1
0
def test_compiler_generate(patch, magic):
    patch.init(Lowering)
    patch.object(Lowering, "process")
    patch.object(Semantics, "process")
    patch.many(JSONCompiler, ["compile"])
    tree = magic()
    storycontext = magic()
    result = Compiler.generate(tree, storycontext=storycontext, scope=None)
    Lowering.__init__.assert_called_with(parser=tree.parser,
                                         features=storycontext.features)
    Lowering.process.assert_called_with(tree)
    Semantics.process.assert_called_with(Lowering.process())
    assert result == (Lowering.process(), Semantics.process())
示例#2
0
def test_compiler_generate(patch, magic):
    patch.init(Lowering)
    patch.object(Lowering, 'process')
    patch.object(Semantics, 'process')
    patch.many(JSONCompiler, ['compile'])
    tree = magic()
    result = Compiler.generate(tree, features=None)
    Lowering.__init__.assert_called_with(parser=tree.parser, features=None)
    Lowering.process.assert_called_with(tree)
    Semantics.process.assert_called_with(Lowering.process())
    assert result == Semantics.process()