Exemple #1
0
def test_faketree_assignment(patch, tree, fake_tree):
    patch.many(FakeTree, ["path", "get_line", "set_line"])
    result = fake_tree.assignment(tree)
    FakeTree.get_line.assert_called_with(tree)
    line = FakeTree.get_line()
    FakeTree.set_line.assert_called_with(tree, line)
    FakeTree.path.assert_called_with(line=line)
    assert result.children[0] == FakeTree.path()
    tree = Tree("base_expression", [tree])
    subtree = [Token("EQUALS", "=", line=line), tree]
    expected = Tree("assignment_fragment", subtree)
    assert result.children[1] == expected
Exemple #2
0
def test_faketree_assignment(patch, tree, fake_tree):
    patch.many(FakeTree, ['path', 'get_line', 'set_line'])
    result = fake_tree.assignment(tree)
    FakeTree.get_line.assert_called_with(tree)
    line = FakeTree.get_line()
    FakeTree.set_line.assert_called_with(tree, line)
    FakeTree.path.assert_called_with(line=line)
    assert result.children[0] == FakeTree.path()
    tree = Tree('base_expression', [tree])
    subtree = [Token('EQUALS', '=', line=line), tree]
    expected = Tree('assignment_fragment', subtree)
    assert result.children[1] == expected