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

L = coral.lang.UML14

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

print "Setting supplier wrongly"
try:
    d = L.Dependency(supplier = c)
except (IndexError, RuntimeError),e:
    assert str(e).find("slot supplier can contain many values") != -1
else:
    assert 0

print "Setting supplier correctly"
d = L.Dependency(supplier = [ c ])

print "Modifying supplier..."
ok = False
try:
    d.namespace = d.supplier.namespace
except (IndexError, RuntimeError), e:
    assert str(e).find("when setting slot namespace. Are you sure") != -1
else:
    assert 0

