'A diff composed of two separate ``set`` operations can be applied to a
nested object without triggering an invariant exception.'

def test_deep_swap(self):

    a = DiffTestObjInvariant(a=1, b=2)
    b = DiffTestObjInvariant(a=3, b=4)
    o1 = DiffTestObjInvariant(a=a, b=b)
    o2 = o1.transform(['a'], DiffTestObjInvariant(a=2, b=1))
    diff = create_diff(o1, o2)
    self.expectThat(len(diff.changes), Equals(2))
    self.assertEqual(o2, diff.apply(o1))
