#!/usr/bin/env python
import coral
L = coral.lang.UML14


m = L.Model()
c = L.Class()
c.namespace = m

i = L.Instance()
i.namespace = m
c.instance.append(i)

m.isWellFormed()

c2 = coral.ModelCopy_One(c)

assert(c2.namespace == m)
assert(len(c2.instance) == 1)
assert(c2.instance[0] == c.instance[0])
#
# This is the problematic part
# Our association in c.instance pointed
# outside out modelcopy subtree.
# And there is nothing currently in modelcopy
# to fix this.
# => i.classifier still only contains [c],
# not [c, c2]
#
assert(len(i.classifier) == 2)

