#!/usr/bin/env python
import coral

def obs(direction):
    i = 0
    for c in tm.getCurrentTransaction():
        i += 1
    assert i == 2
    
tm = coral.getTransactionManager()
tm.addObserver(obs)

s1 = coral.lang.UML14.Class()

tm.beginModifyCmd()
try:
    s2 = coral.lang.UML14.Class()
    s3 = coral.lang.UML14.Class()
finally:
    tm.endModifyCmd()

