def test_copy_location(node): references.add_parent_references(node) references.add_sibling_references(node) original = node.targets[0] dupe = references.copy_location( ast.Name(id='y', ctx=ast.Store()), original, ) assert dupe.parent is original.parent assert dupe.previous is original.previous assert dupe.next is original.next
def test_copy_location(node): """Test that references are preserved by the custom copy_location.""" references.add_parent_references(node) references.add_sibling_references(node) original = node.targets[0] dupe = references.copy_location( ast.Name(id='y', ctx=ast.Store()), original, ) assert dupe.parent is original.parent assert dupe.previous is original.previous assert dupe.next is original.next