Esempio n. 1
0
def test_compiler_chained_mutations(patch, magic, tree):
    patch.object(Objects, 'mutation')
    mutation = magic()
    tree.find_data.return_value = [mutation]
    result = Compiler.chained_mutations(tree)
    Objects.mutation.assert_called_with(mutation.mutation_fragment)
    assert result == [Objects.mutation()]
Esempio n. 2
0
def test_compiler_indented_chain(patch, compiler, lines, tree):
    patch.object(Compiler, 'chained_mutations')
    lines.last.return_value = '1'
    lines.lines = {'1': {'method': 'mutation', 'args': ['args']}}
    compiler.indented_chain(tree, '0')
    Compiler.chained_mutations.assert_called_with(tree)
    assert lines.lines['1']['args'] == ['args'] + Compiler.chained_mutations()