# 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
# 
# class UnsupportedOperationException (Exception):
# 
#     """Exception to match Java's exception of the same name."""
# 
#     pass


from tmapi.exceptions import ModelConstraintException, \
    UnsupportedOperationException
from tmapi_test_case import TMAPITestCase

"""Module containing tests for the TopicMap model.

Most if not all of these tests are ported from the public domain tests
that come with the TMAPI 2.0 distribution (http://www.tmapi.org/2.0/).

"""




class TopicMapTest (TMAPITestCase):

    def test_parent (self):
        """Tests if TopicMap.get_parent() returns None."""
        self.assertEqual(None, self.tm.get_parent())
        
    def test_topic_creation_subject_identifier (self):
        locator = self.create_locator('http://www.example.org/')
        self.assertEqual(0, self.tm.get_topics().count())
        topic = self.tm.create_topic_by_subject_identifier(locator)
        self.assertEqual(1, self.tm.get_topics().count())
        self.assertTrue(topic in self.tm.get_topics())
        self.assertEqual(1, topic.get_subject_identifiers().count())
        self.assertEqual(0, topic.get_item_identifiers().count())
        self.assertEqual(0, topic.get_subject_locators().count())
        locator2 = topic.get_subject_identifiers()[0]
        self.assertEqual(locator, locator2)

    def test_topic_creation_subject_identifier_illegal (self):

# 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
# 
# class UnsupportedOperationException (Exception):
# 
#     """Exception to match Java's exception of the same name."""
# 
#     pass


# Path: tmapi/tests/models/test_topic_map.py
from tmapi.exceptions import ModelConstraintException, \
    UnsupportedOperationException
from tmapi_test_case import TMAPITestCase


"""Module containing tests for the TopicMap model.

Most if not all of these tests are ported from the public domain tests
that come with the TMAPI 2.0 distribution (http://www.tmapi.org/2.0/).

"""




class TopicMapTest (TMAPITestCase):

    def test_parent (self):
        """Tests if TopicMap.get_parent() returns None."""
        self.assertEqual(None, self.tm.get_parent())
        
    def test_topic_creation_subject_identifier (self):
        locator = self.create_locator('http://www.example.org/')
        self.assertEqual(0, self.tm.get_topics().count())
        topic = self.tm.create_topic_by_subject_identifier(locator)
        self.assertEqual(1, self.tm.get_topics().count())
        self.assertTrue(topic in self.tm.get_topics())
        self.assertEqual(1, topic.get_subject_identifiers().count())
        self.assertEqual(0, topic.get_item_identifiers().count())
        self.assertEqual(0, topic.get_subject_locators().count())
        locator2 = topic.get_subject_identifiers()[0]
        self.assertEqual(locator, locator2)

    def test_topic_creation_subject_identifier_illegal (self):

        self.assertRaises(ModelConstraintException,