示例#1
0
def is_single_block(string):
    codeblock = ch.CodeBlock(0)
    codeblock.string = '\n'.join(s.rstrip(' ')
                    for s in 
                    ''.join(ch.xreadlines(string.expandtabs())).split('\n'))
    block_list = list( ch.iterblocks(ch.xreadlines(string)) )
    assert_equal(line_list_signature([codeblock]), 
                        line_list_signature(block_list))
示例#2
0
def is_single_block(string):
    codeblock = ch.CodeBlock(0)
    codeblock.string = '\n'.join(
        s.rstrip(' ')
        for s in ''.join(ch.xreadlines(string.expandtabs())).split('\n'))
    block_list = list(ch.iterblocks(ch.xreadlines(string)))
    assert_equal(line_list_signature([codeblock]),
                 line_list_signature(block_list))
示例#3
0
def test_double_function_non_empty_line():
    string = """
def f():
\tpass
\t
def g():
\tpass
"""
    blocks = list(ch.iterblocks(ch.xreadlines(string)))
    # This should be made of three blocks, the last one of them
    # empty.
    assert_equal(len(blocks), 3)
示例#4
0
def test_double_function_non_empty_line():
    string = """
def f():
\tpass
\t
def g():
\tpass
"""
    blocks = list(ch.iterblocks(ch.xreadlines(string)))
    # This should be made of three blocks, the last one of them
    # empty.
    assert_equal(len(blocks), 3)
示例#5
0
def is_same_code(codestring):
    out = ''.join([i.string
                for i in ch.iterblocks(ch.xreadlines(codestring))])
    assert_equal(codestring.expandtabs(), out)
示例#6
0
def is_same_code(codestring):
    out = ''.join([i.string for i in ch.iterblocks(ch.xreadlines(codestring))])
    assert_equal(codestring.expandtabs(), out)