@@ -0,0 +1,2289 @@
+#----------------------------------------------------------------------------%0A# Copyright (c) 2014, Enthought, Inc.%0A# All rights reserved.%0A#%0A# This software is provided without warranty under the terms of the BSD%0A# license included in /LICENSE.txt and may be redistributed only%0A# under the conditions described in the aforementioned license.  The license%0A# is also available online at http://www.enthought.com/licenses/BSD.txt%0A#%0A# Thanks for using Enthought open source!%0A#%0A#----------------------------------------------------------------------------%0Aimport unittest%0Afrom traits.util.event_tracer import (%0A    BaseMessageRecord, ChangeMessageRecord, CallingMessageRecord,%0A    ExitMessageRecord)%0A%0A%0Aclass TestMessageRecords(unittest.TestCase):%0A%0A    def test_base_message_record(self):%0A        record = BaseMessageRecord()%0A%0A        # Check unicode output%0A        self.assertEqual(unicode(record), u'%5Cn')%0A%0A        # Check initialization%0A        with self.assertRaises(TypeError):%0A            BaseMessageRecord(sdd=0)%0A%0A    def test_change_message_record(self):%0A        record = ChangeMessageRecord(%0A            time=1,  indent=3, name='john', old=1, new=1,%0A            class_name='MyClass')%0A%0A        # Check unicode output%0A        self.assertEqual(%0A            unicode(record),%0A            u%221 -----%3E 'john' changed from 1 to 1 in 'MyClass'%5Cn%22)%0A%0A        # Check initialization%0A        with self.assertRaises(TypeError):%0A            ChangeMessageRecord(sdd=0)%0A%0A    def test_exit_message_record(self):%0A        record = ExitMessageRecord(%0A            time=7,  indent=5, handler='john', exception='sssss')%0A%0A        # Check unicode output%0A        self.assertEqual(%0A            unicode(record), u%227 %3C--------- EXIT: 'john'sssss%5Cn%22)%0A%0A        # Check initialization%0A        with self.assertRaises(TypeError):%0A            ExitMessageRecord(sdd=0)%0A%0A    def test_calling_message_record(self):%0A        record = CallingMessageRecord(%0A            time=7,  indent=5, action='run', handler='john', source='sssss')%0A%0A        # Check unicode output%0A        self.assertEqual(%0A            unicode(record), u%227                 run: 'john' in sssss%5Cn%22)%0A%0A        # Check initialization%0A        with self.assertRaises(TypeError):%0A            CallingMessageRecord(sdd=0)%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

add tests for the message records