Пример #1
0
def test_format_as_bytes():
    results = Utils.format_bytes(size=1023, style='short')
    expected = (1023, 'B')
    assert results == expected
Пример #2
0
def test_format_as_long_kilobytes():
    results = Utils.format_bytes(size=765.4 * 1024, style='long')
    expected = (765.4, 'Kilobytes')
    assert results == expected
Пример #3
0
def test_format_as_long_megabytes():
    results = Utils.format_bytes(size=1.5 * 1024 ** 2, style='long')
    expected = (1.5, 'Megabytes')
    assert results == expected
Пример #4
0
def test_format_as_short_terabytes():
    results = Utils.format_bytes(size=723 * 1024 ** 4, style='short')
    expected = (723.0, 'TB')
    assert results == expected
Пример #5
0
def test_format_as_short_yottabytes():
    results = Utils.format_bytes(size=1024 ** 7, style='short')
    expected = (1.0, 'YB')
    assert results == expected
Пример #6
0
def test_format_as_long_terabytes():
    results = Utils.format_bytes(size=723 * 1024 ** 4, style='long')
    expected = (723.0, 'Terabytes')
    assert results == expected
Пример #7
0
def test_draw_line_ten_dashes():
    results = Utils.draw_line(characters="-", length=10)
    expected = "----------"
    assert results == expected
Пример #8
0
def test_format_as_short_kilobytes():
    results = Utils.format_bytes(size=765.4 * 1024, style='short')
    expected = (765.4, 'KB')
    assert results == expected
Пример #9
0
def test_format_as_short_megabytes():
    results = Utils.format_bytes(size=1.5 * 1024 ** 2, style='short')
    expected = (1.5, 'MB')
    assert results == expected
Пример #10
0
def test_draw_default_line():
    results = Utils.draw_line()
    expected = "-=--=--=--=--=--=--=--=--=--=--=--=--=--"
    assert results == expected
Пример #11
0
def test_draw_no_characters():
    results = Utils.draw_line(characters="1234567890", length=0)
    expected = ""
    assert results == expected
Пример #12
0
def test_draw_line_two_characters_from_six():
    results = Utils.draw_line(characters="123456", length=2)
    expected = "12"
    assert results == expected
Пример #13
0
def test_draw_no_line():
    results = Utils.draw_line(length=0)
    expected = ""
    assert results == expected
Пример #14
0
def test_draw_line_eleven_dash_dots():
    results = Utils.draw_line(characters="-.", length=11)
    expected = "-.-.-.-.-.-"
    assert results == expected
Пример #15
0
def test_format_as_long_megabytes_2():
    results = Utils.format_bytes(size=9753 * 1024, style='long')
    expected = (9.5244140625, 'Megabytes')
    assert results == expected
Пример #16
0
def test_format_as_short_megabytes_2():
    results = Utils.format_bytes(size=9753 * 1024, style='short')
    expected = (9.5244140625, 'MB')
    assert results == expected
Пример #17
0
def test_format_as_long_gigabytes():
    results = Utils.format_bytes(size=3 * 1024 ** 3, style='long')
    expected = (3.0, 'Gigabytes')
    assert results == expected
Пример #18
0
def test_format_as_short_gigabytes():
    results = Utils.format_bytes(size=3 * 1024 ** 3, style='short')
    expected = (3.0, 'GB')
    assert results == expected
Пример #19
0
def test_format_as_long_petabytes():
    results = Utils.format_bytes(size=1024 ** 5, style='long')
    expected = (1.0, 'Petabytes')
    assert results == expected
Пример #20
0
def test_draw_line_ten_spaces():
    results = Utils.draw_line(characters=" ", length=10)
    expected = "          "
    assert results == expected