Exemplo n.º 1
0
def test_get_ascii_field():
    g = Grapher()
    values = [0, 1, 2]
    field = g._get_ascii_field(values=values)
    assert field[0][0] == '/'
    assert field[1][1] == '/'
    assert field[2][2] == '-'
    assert field[2][0] == ' '
Exemplo n.º 2
0
def test_draw_ascii_graph():
    g = Grapher()
    values = [0, 1, 2, 2, 1, 0, 3, 0]
    field = g._get_ascii_field(values=values)
    graph_string = g._draw_ascii_graph(field)

    assert '\\' in graph_string
    assert '-' in graph_string
    assert '/' in graph_string
    assert '|' in graph_string
    assert graph_string.count('\n') == 3
    for line in graph_string.splitlines():
        assert len(line) == 8