#!/usr/bin/env python
import coral

TM = coral.getTransactionManager()

L = coral.lang.UML14

m = L.Model()


s = m.name

TM.beginModifyCmd()
try:
    m.name = "hello"
finally:
    TM.endModifyCmd()

assert s != m.name
assert m.name == "hello"
assert s == ""

TM.undo()

assert s == m.name
assert m.name == ""
assert s == ""

TM.redo()

assert s != m.name
assert m.name == "hello"
assert s == ""

