# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# 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.constants import XSD_ANY_URI
from tmapi.exceptions import ModelConstraintException
from tmapi_test_case import TMAPITestCase
"""




class NameTest (TMAPITestCase):

    def test_parent (self):
        parent = self.create_topic()
        self.assertEqual(0, parent.get_names().count(),
                         'Expected new topics to be created with no names')
        name = parent.create_name('Name')
        self.assertEqual(parent, name.get_parent(),
                         'Unexpected name parent after creation')
        self.assertEqual(1, parent.get_names().count(),
                         'Expected name list size to increment for topic')
        self.assertTrue(name in parent.get_names(),
                        'Name is not part of get_names()')
        name.remove()
        self.assertEqual(0, parent.get_names().count(),
                         'Expected name list size to decrement for topic')

    def test_value (self):
        value1 = 'TMAPI Name'
        value2 = 'A name'
        name = self.create_name()
        name.set_value(value1)
        self.assertEqual(value1, name.get_value())
        name.set_value(value2)
        self.assertEqual(value2, name.get_value())

# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# 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_name.py
from tmapi.constants import XSD_ANY_URI
from tmapi.exceptions import ModelConstraintException
from tmapi_test_case import TMAPITestCase

"""




class NameTest (TMAPITestCase):

    def test_parent (self):
        parent = self.create_topic()
        self.assertEqual(0, parent.get_names().count(),
                         'Expected new topics to be created with no names')
        name = parent.create_name('Name')
        self.assertEqual(parent, name.get_parent(),
                         'Unexpected name parent after creation')
        self.assertEqual(1, parent.get_names().count(),
                         'Expected name list size to increment for topic')
        self.assertTrue(name in parent.get_names(),
                        'Name is not part of get_names()')
        name.remove()
        self.assertEqual(0, parent.get_names().count(),
                         'Expected name list size to decrement for topic')

    def test_value (self):
        value1 = 'TMAPI Name'
        value2 = 'A name'
        name = self.create_name()
        name.set_value(value1)
        self.assertEqual(value1, name.get_value())
        name.set_value(value2)
        self.assertEqual(value2, name.get_value())

        self.assertRaises(ModelConstraintException, name.set_value, None)