Ejemplo n.º 1
0
    def test_TaggingConsumer(self):

        h = StringIO()
        tc = ParserSupport.TaggingConsumer(handle=h, colwidth=5)
        tc.start_section()
        self.assertEqual(h.getvalue(), "***** start_section\n")
        h.seek(0)
        h.truncate(0)
        tc.test1("myline")
        self.assertEqual(h.getvalue(), "test1: myline\n")
        h.seek(0)
        h.truncate(0)
        tc.end_section()
        self.assertEqual(h.getvalue(), "***** end_section\n")
Ejemplo n.º 2
0
        return 1
    return 0

# TaggingConsumer


print("Running tests on TaggingConsumer")


class TestHandle(object):
    def write(self, s):
        print(s)


h = TestHandle()
tc = ParserSupport.TaggingConsumer(handle=h, colwidth=5)
tc.start_section()  # '***** start_section\n'
tc.test1('myline')  # 'test1: myline\n'
tc.end_section()    # '***** end_section\n'


# is_blank_line

print("Running tests on is_blank_line")


def is_blank_line(*args, **keywds):
    return pb(ParserSupport.is_blank_line(*args, **keywds))


print(is_blank_line('\n'))                              # 1