# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


from tmapi.exceptions import ModelConstraintException
from tmapi_test_case import TMAPITestCase
        self.assertEqual(0, association.get_roles(unused_type).count())
        role1 = association.create_role(type1, self.create_topic())
        self.assertEqual(1, association.get_roles(type1).count())
        self.assertTrue(role1 in association.get_roles(type1))
        self.assertEqual(0, association.get_roles(type2).count())
        self.assertEqual(0, association.get_roles(unused_type).count())
        role2 = association.create_role(type2, self.create_topic())
        self.assertEqual(1, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        role3 = association.create_role(type2, self.create_topic())
        self.assertEqual(2, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        self.assertTrue(role3 in association.get_roles(type2))
        self.assertEqual(0, association.get_roles(unused_type).count())
        role3.remove()
        self.assertEqual(1, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        role2.remove()
        self.assertEqual(0, association.get_roles(type2).count())
        role1.remove()
        self.assertEqual(0, association.get_roles(type1).count())
        self.assertEqual(0, association.get_roles(unused_type).count())

    def test_role_filter_illegal (self):
        # This test is not applicable in this implementation.
        pass
        
    def test_role_creation_invalid_player (self):
        association = self.create_association()
        self.assertEqual(0, association.get_roles().count())

# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


# Path: tmapi/tests/models/test_association.py
from tmapi.exceptions import ModelConstraintException
from tmapi_test_case import TMAPITestCase

        self.assertEqual(0, association.get_roles(unused_type).count())
        role1 = association.create_role(type1, self.create_topic())
        self.assertEqual(1, association.get_roles(type1).count())
        self.assertTrue(role1 in association.get_roles(type1))
        self.assertEqual(0, association.get_roles(type2).count())
        self.assertEqual(0, association.get_roles(unused_type).count())
        role2 = association.create_role(type2, self.create_topic())
        self.assertEqual(1, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        role3 = association.create_role(type2, self.create_topic())
        self.assertEqual(2, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        self.assertTrue(role3 in association.get_roles(type2))
        self.assertEqual(0, association.get_roles(unused_type).count())
        role3.remove()
        self.assertEqual(1, association.get_roles(type2).count())
        self.assertTrue(role2 in association.get_roles(type2))
        role2.remove()
        self.assertEqual(0, association.get_roles(type2).count())
        role1.remove()
        self.assertEqual(0, association.get_roles(type1).count())
        self.assertEqual(0, association.get_roles(unused_type).count())

    def test_role_filter_illegal (self):
        # This test is not applicable in this implementation.
        pass
        
    def test_role_creation_invalid_player (self):
        association = self.create_association()
        self.assertEqual(0, association.get_roles().count())

        self.assertRaises(ModelConstraintException, association.create_role,