#!/usr/bin/env python
import coral


c1 = coral.lang.UML14.Class()
c2 = coral.lang.UML14.Class()
c1.name = "hello"
c2.name = "world"

tm = coral.getTransactionManager()

assert not tm.canUndo()

tm.beginModifyCmd()
try:
    c2.name = c1.name
finally:
    tm.endModifyCmd()

assert tm.canUndo()
assert c2.name == "hello"
tm.undo()
assert c2.name == "world"

