#!/usr/bin/env python
import coral
import time

L = coral.lang.UML14

prj = coral.Project()

M = L.Model()

P = L.Package()
T = L.TaggedValue()

M.__setProject__(prj)
M.ownedElement.append(P)
P.ownedElement.append(T)

# The following comment is old. The append nowadays throws an exception.
# #NOTE! We (wrongly) share it.  This is wrong, but Coral shouldn't
# #crash due to it when saving/loading/using If in debug mode, this
# #will print a huge critical warning. That's deliberate here.

ok = True
try:
    M.taggedValue.append(T)
except coral.WFRException:
    ok = False

assert ok

# We still should succeed in loading them.
prj1 = coral.loadDocument("shared_point.xmi")
prj2 = coral.loadDocument("shared_point2.xmi")
