Ejemplo n.º 1
0
def test_clearline():
    """
    Make sure a question mark is printed if the total is unknown

    pytest ubelt/tests/test_progiter.py::test_clearline
    """
    file = cStringIO()
    # Clearline=False version should simply have a newline at the end.
    prog = ProgIter(file=file, show_times=False, clearline=False)
    message = prog.format_message()
    assert strip_ansi(message).strip(' ') == '0/?... \n'
    # Clearline=True version should carrage return at the begining and have no
    # newline at the end.
    prog = ProgIter(file=file, show_times=False, clearline=True)
    message = prog.format_message()
    assert strip_ansi(message).strip(' ') == '\r    0/?...'
Ejemplo n.º 2
0
def test_initial():
    """
    Make sure a question mark is printed if the total is unknown
    """
    file = cStringIO()
    prog = ProgIter(initial=9001, file=file, show_times=False, clearline=False)
    message = prog.format_message()
    assert strip_ansi(message) == ' 9001/?... \n'