コード例 #1
0
    def test_base_message_record(self):
        record = SentinelRecord()

        # Check unicode output
        self.assertEqual(unicode(record), u'\n')

        # Check initialization
        self.assertRaises(TypeError, SentinelRecord, sdd=0)
コード例 #2
0
    def test_base_message_record(self):
        record = SentinelRecord()

        # Check str output
        self.assertEqual(str(record), "\n")

        # Check initialization
        self.assertRaises(TypeError, SentinelRecord, sdd=0)
コード例 #3
0
    def test_record_container(self):
        container = RecordContainer()

        # add records
        for i in range(7):
            container.record(SentinelRecord())
        self.assertEqual(len(container._records), 7)

        # save records
        container.save_to_file(self.filename)

        with open(self.filename, 'r') as handle:
            lines = handle.readlines()
        self.assertEqual(lines, ['\n'] * 7)
コード例 #4
0
 def record(container):
     thread = threading.current_thread().name
     collector = container.get_change_event_collector(thread)
     collector.record(SentinelRecord())