Esempio n. 1
0
def test_preprocessor_assignment_expression(patch, magic, tree):
    patch.many(Preprocessor, ['fake_tree', 'replace_expression'])
    block = magic()
    Preprocessor.assignment_expression(block, tree)
    Preprocessor.fake_tree.assert_called_with(block)
    parent = block.rules.assignment.assignment_fragment
    args = (Preprocessor.fake_tree(), parent, tree.inline_expression)
    Preprocessor.replace_expression.assert_called_with(*args)
Esempio n. 2
0
def test_preprocessor_service_arguments(patch, magic, tree):
    patch.many(Preprocessor, ['fake_tree', 'replace_expression'])
    argument = magic()
    tree.find_data.return_value = [argument]
    Preprocessor.service_arguments('block', tree)
    Preprocessor.fake_tree.assert_called_with('block')
    tree.find_data.assert_called_with('arguments')
    argument.node.assert_called_with('values.inline_expression')
    args = (Preprocessor.fake_tree(), argument, argument.node())
    Preprocessor.replace_expression.assert_called_with(*args)
Esempio n. 3
0
def test_preprocessor_fake_tree(patch):
    patch.init(FakeTree)
    result = Preprocessor.fake_tree('block')
    FakeTree.__init__.assert_called_with('block')
    assert isinstance(result, FakeTree)