Example #1
0
def test_compiler_extract_values(patch, tree):
    patch.object(Objects, 'entity')
    tree.expression = None
    result = JSONCompiler(story=None).extract_values(tree)
    tree.child.assert_called_with(1)
    Objects.entity.assert_called_with(tree.child())
    assert result == [Objects.entity()]
Example #2
0
def test_compiler_throw_name_statement(patch, compiler, lines, tree):
    patch.object(Objects, 'entity')
    tree.children = [Token('RAISE', 'throw'), Token('NAME', 'error')]
    compiler.throw_statement(tree, '1')
    args = [Objects.entity()]
    lines.append.assert_called_with('throw', tree.position(), args=args,
                                    parent='1')
Example #3
0
def test_compiler_throw_name_statement(patch, compiler, lines, tree):
    patch.object(Objects, "entity")
    tree.children = [Token("RAISE", "throw"), Token("NAME", "error")]
    compiler.throw_statement(tree, "1")
    args = [Objects.entity()]
    lines.append.assert_called_with(
        "throw", tree.position(), args=args, parent="1"
    )