Example #1
0
def test_pretty_print_multiline_string_long():
    ins = '\n'.join('line %i' % i for i in range(64))
    prefix = '+'
    io = StringIO()
    pp.pretty_print_value(ins, prefix, io)
    text = io.getvalue()
    lines = text.splitlines(False)
    assert len(lines) == 64
    assert (prefix + 'line 32') in lines
Example #2
0
def test_pretty_print_multiline_string_long():
    ins = '\n'.join('line %i' % i for i in range(64))
    prefix = '+'
    config = TestConfig()
    pp.pretty_print_value(ins, prefix, config)
    text = config.out.getvalue()
    lines = text.splitlines(False)
    assert len(lines) == 64
    assert (prefix + 'line 32') in lines
Example #3
0
def test_pretty_print_multiline_string_long():
    ins = '\n'.join('line %i' % i for i in range(64))
    prefix = '+'
    io = StringIO()
    pp.pretty_print_value(ins, prefix, io)
    text = io.getvalue()
    lines = text.splitlines(False)
    assert len(lines) == 64
    assert (prefix + 'line 32') in lines
Example #4
0
def test_pretty_print_value_int():
    v = 5
    assert pp.format_value(v) == '5'
    config = TestConfig()
    pp.pretty_print_value(v, "+", config)
    text = config.out.getvalue()
    print("'%s'" % text)
    assert "+5" in text
    # path is only used for dispatching to special formatters
    assert "dummypath" not in text
Example #5
0
def test_pretty_print_value_int():
    v = 5
    assert pp.format_value(v) == '5'
    io = StringIO()
    pp.pretty_print_value(v, "+", io)
    text = io.getvalue()
    print("'%s'" % text)
    assert "+5" in text
    # path is only used for dispatching to special formatters
    assert "dummypath" not in text
Example #6
0
def test_pretty_print_value_int():
    v = 5
    assert pp.format_value(v) == '5'
    io = StringIO()
    pp.pretty_print_value(v, "+", io)
    text = io.getvalue()
    print("'%s'" % text)
    assert "+5" in text
    # path is only used for dispatching to special formatters
    assert "dummypath" not in text
Example #7
0
def test_pretty_print_multiline_string_b64():
    ins = b64text(1024)
    prefix = '+'
    config = TestConfig()
    pp.pretty_print_value(ins, prefix, config)
    text = config.out.getvalue()
    lines = text.splitlines(True)
    assert len(lines) == 1
    line = lines[0]
    assert line.startswith(prefix)
    assert len(line) < 100
    assert 'snip base64' in line
Example #8
0
def test_pretty_print_multiline_string_b64():
    ins = b64text(1024)
    prefix = '+'
    io = StringIO()
    pp.pretty_print_value(ins, prefix, io)
    text = io.getvalue()
    lines = text.splitlines(True)
    assert len(lines) == 1
    line = lines[0]
    assert line.startswith(prefix)
    assert len(line) < 100
    assert 'snip base64' in line
Example #9
0
def test_pretty_print_multiline_string_b64():
    ins = b64text(1024)
    prefix = '+'
    io = StringIO()
    pp.pretty_print_value(ins, prefix, io)
    text = io.getvalue()
    lines = text.splitlines(True)
    assert len(lines) == 1
    line = lines[0]
    assert line.startswith(prefix)
    assert len(line) < 100
    assert 'snip base64' in line