def test_dict() -> None:
    base = C5(dict(hello='world'))
    new = copy.deepcopy(base)
    new.a['hello'] = 'goodbye'

    ops = delta(base, new)
    assert ops == [GetAttr('a'), SetItem('hello', 'goodbye')]
def test_nested_list() -> None:
    base = C3([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

    new = copy.deepcopy(base)
    new.a[1][1] = -2

    ops = delta(base, new)
    assert ops == [GetAttr('a'), GetItem(1), SetItem(1, -2)]
def test_nested_dict() -> None:
    base = C7(dict(hello=C6([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))
    new = copy.deepcopy(base)
    new.a['hello'].a[1][1] = -2
    new.a['hello'].a[2][2] = -4

    ops = delta(base, new)
    # yapf: disable
    assert ops == [
        GetAttr('a'), GetItem('hello'), GetAttr('a'), GetItem(1), SetItem(1, -2),
        GetAttr('a'), GetItem('hello'), GetAttr('a'), GetItem(2), SetItem(2, -4),
    ]
def test_nested_list_2() -> None:
    base = C4([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

    new = copy.deepcopy(base)
    new.a[1][1] = -2
    new.a[2][2] = -4

    ops = delta(base, new)
    # yapf: disable
    assert ops == [
        GetAttr('a'), GetItem(1), SetItem(1, -2),
        GetAttr('a'), GetItem(2), SetItem(2, -4)
    ]
def test_list() -> None:
    base = C2([1, 2, 3])
    new = C2([1, 2, 2])

    ops = delta(base, new)
    assert ops == [GetAttr('a'), SetItem(2, 2)]
def test_simple() -> None:
    base = C1(5)
    new = C1(3)

    ops = delta(base, new)
    assert ops == [SetAttr('a', 3)]