#!/usr/bin/env python
#
# Tests that Element.__switchType__ works, at least somehow
#
import coral

DI = coral.lang.XMIDI20

p = DI.Point()

assert p.oclIsKindOf(DI.Point)
p.__switchType__(DI.BezierPoint)
assert p.oclIsKindOf(DI.BezierPoint)

p.controls.add(DI.Point())

p.__switchType__(DI.Point)
assert p.oclIsKindOf(DI.Point)
assert not p.oclIsKindOf(DI.BezierPoint)

ok = False
try:
    p.controls
except:
    ok = True

assert ok
