mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Show size of database file next to download link, closes #172
This commit is contained in:
parent
195a5b3634
commit
4462a5ab28
7 changed files with 37 additions and 1 deletions
|
|
@ -374,3 +374,18 @@ def test_path_with_format(path, format, extra_qs, expected):
|
|||
)
|
||||
actual = utils.path_with_format(request, format, extra_qs)
|
||||
assert expected == actual
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"bytes,expected",
|
||||
[
|
||||
(120, '120 bytes'),
|
||||
(1024, '1.0 KB'),
|
||||
(1024 * 1024, '1.0 MB'),
|
||||
(1024 * 1024 * 1024, '1.0 GB'),
|
||||
(1024 * 1024 * 1024 * 1.3, '1.3 GB'),
|
||||
(1024 * 1024 * 1024 * 1024, '1.0 TB'),
|
||||
]
|
||||
)
|
||||
def test_format_bytes(bytes, expected):
|
||||
assert expected == utils.format_bytes(bytes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue