예제 #1
0
    def test_neg_06(self):
        "TestRecordTxt2: long long line - check for multiple errors"

        tioconfig = TxtIOConfig()
        tioconfig.set_max_line_length(7)
        txt_doc = TxtRecord.from_string("""#1 com
ok: yes
 no
#4 cs
#5 dds
good: but too long
#7 dds
#8 hi
also good: but too long
#10 gsst
 dhd
#12 dhdh 
d:
#14
""", 
                                        "TooLong", tioconfig)

        assert(txt_doc.is_usable()==False)
        assert(txt_doc.to_list() ==
               [[80, MemLog.error, 'line too long: is [18], max allowed [7]', 
                 'TooLong', 6], 
                [80, MemLog.error, 'line too long: is [23], max allowed [7]', 
                 'TooLong', 9],
                [80, MemLog.error, 'line too long: is [8], max allowed [7]',
                 'TooLong', 10],
                [80, MemLog.error, 'line too long: is [9], max allowed [7]', 
                 'TooLong', 12], 
                [80, MemLog.info, TxtParser.comment_in_req, 'TooLong', 11]])
예제 #2
0
    def test_neg_04(self):
        "TestRecordTxt2: long long line"

        tioconfig = TxtIOConfig()
        tioconfig.set_max_line_length(7)
        txt_doc = TxtRecord.from_string("good: but too long", 
                                        "TooLong", tioconfig)

        assert(txt_doc.is_usable()==False)
        assert(txt_doc.to_list() ==
               [[80, MemLog.error, 'line too long: is [18], max allowed [7]', 
                 'TooLong', 1]])
예제 #3
0
    def test_neg_05(self):
        "TestRecordTxt2: long long line - check for lineno"

        tioconfig = TxtIOConfig()
        tioconfig.set_max_line_length(7)
        txt_doc = TxtRecord.from_string("""# com
ok: yes
 no
# cs
# dds
good: but too long
# dds

""", 
                                        "TooLong", tioconfig)

        assert(txt_doc.is_usable()==False)
        assert([[80, MemLog.error, 'line too long: is [18], max allowed [7]',
                  'TooLong', 6]] == txt_doc.to_list())