Beispiel #1
0
def test_indent():
    line = "12345678901234567890"
    ret = code.reflow_line(line, 1, 100)
    eq_(ret, [code.INDENT+line])
    ret = code.reflow_line(line, 1, 10)
    eq_(ret, [code.INDENT+line[:8]+'&',
              code.INDENT+'&'+line[8:16]+'&',
              code.INDENT+'&'+line[16:]])
Beispiel #2
0
def test_indent():
    line = "12345678901234567890"
    ret = code.reflow_line(line, 1, 100)
    eq_(ret, [code.INDENT + line])
    ret = code.reflow_line(line, 1, 10)
    eq_(ret, [
        code.INDENT + line[:8] + '&', code.INDENT + '&' + line[8:16] + '&',
        code.INDENT + '&' + line[16:]
    ])
Beispiel #3
0
def breakup_gen(line, chunk):
    ret = code.reflow_line(line, 0, chunk)
    eq_(simple_break(line, chunk), ret)
    for part in ret[1:-1]:
        eq_(len(part), chunk + 2)
    if len(ret) == 1:
        eq_(len(ret[0]), len(line))
    else:
        eq_(len(ret[0]), chunk + 1)
        ok_(len(ret[-1]) <= chunk + 1)
    orig = ''.join(ret)
    orig = orig.replace('&', '')
    eq_(orig, line)
Beispiel #4
0
def breakup_gen(line, chunk):
    ret = code.reflow_line(line, 0, chunk)
    eq_(simple_break(line, chunk), ret)
    for part in ret[1:-1]:
        eq_(len(part), chunk + 2)
    if len(ret) == 1:
        eq_(len(ret[0]), len(line))
    else:
        eq_(len(ret[0]), chunk + 1)
        ok_(len(ret[-1]) <= chunk + 1)
    orig = "".join(ret)
    orig = orig.replace("&", "")
    eq_(orig, line)
Beispiel #5
0
def test_nobreak():
    line = ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
            "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ret = code.reflow_line(line, 0, 100)
    eq_(ret, [line])
Beispiel #6
0
def test_nobreak():
    line = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    ret = code.reflow_line(line, 0, 100)
    eq_(ret, [line])