mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 21:08:53 -06:00
refactor: print sizes with one function
core.sizes.size_text replaces readme format_size, release record size_text, render fmt_size, the large-files notes _mib and the handheld _size. It prints one decimal in the largest unit reached, as the site and the installer already did. The README download table, the release notes and the large-files page now say 29.2 MB where they said 29 MB, a handheld archive says 85.3 KB where it said 85 KB, and a large-files asset under 1 MB is given in KB.
This commit is contained in:
1 parent
3a76cf48ba
commit
ab0805e6cb
19 files changed
+60
-71
No files matched your search
@@ -797,13 +797,14 @@ class PublishedNumbersShareOneFormat(unittest.TestCase):
|
||||
the site home as 15.6 GB, and the emulators page `10095 files`."""
|
||||
|
||||
def test_generators_format_counts_and_sizes_alike(self):
|
||||
from core.sizes import size_text
|
||||
from sitegen import readme as sitegen_readme
|
||||
|
||||
readme_source = inspect.getsource(sitegen_readme.generate_readme)
|
||||
self.assertNotIn("size_mb", readme_source)
|
||||
self.assertIn("format_size(size)", readme_source)
|
||||
self.assertIn("size_text(size)", readme_source)
|
||||
self.assertIn("{total_files:,}", script_source("generate_site.py"))
|
||||
self.assertEqual(sitegen_readme.format_size(16011 * 1024 * 1024), "15.6 GB")
|
||||
self.assertEqual(size_text(16011 * 1024 * 1024), "15.6 GB")
|
||||
|
||||
def test_the_readme_has_no_bare_large_count(self):
|
||||
readme = (ROOT / "README.md").read_text(encoding="utf-8")
|
||||
|
||||
Reference in new issue
Block a user