from trashtalk.tools import human_readable_from_bytes


def test_human_readable_from_bytes():
    b = human_readable_from_bytes(500)
    k = human_readable_from_bytes(1024)
    m = human_readable_from_bytes(1024**2)
    g = human_readable_from_bytes(1024**3)
    t = human_readable_from_bytes(1024**4)
    p = human_readable_from_bytes(1024**5)
    e = human_readable_from_bytes(1024**6)
    z = human_readable_from_bytes(1024**7)
    y = human_readable_from_bytes(1024**8)

    assert b == '500'
    assert k == "1K"
    assert m == "1M"
    assert g == "1G"
    assert t == "1T"
    assert p == "1P"
    assert e == "1E"
    assert z == "1Z"
    assert y == "1Y"

    assert "test error" == human_readable_from_bytes("test error")

@@ -46,16 +46,29 @@
 om_bytes
+, print_files
 %0A%0A%0Adef t
@@ -739,8 +739,314 @@
 error%22)%0A
+%0Adef test_print_files(capsys):%0A    l = %5B%5B%22un%22, 2, 3, 4%5D, %5B%22deux%22, 2, 3%5D, %5B%22trois%22, 2, 3, 4%5D%5D%0A    print_files(l, 4)%0A    out, err = capsys.readouterr()%0A    assert bool(err) == False%0A    s = out.split('%5Cn')%0A    assert s%5B0%5D == %22un    2  3 4%22%0A    assert s%5B1%5D == %22deux  2  3  %22%0A    assert s%5B2%5D == %22trois 2  3 4%22%0A

test print files