mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 04:18:52 -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
@@ -18,6 +18,7 @@ import unittest
|
||||
from functools import cache
|
||||
from pathlib import Path
|
||||
|
||||
from core.sizes import size_text
|
||||
from model import releaserecord
|
||||
from sitegen.readme import (
|
||||
SITE_URL,
|
||||
@@ -25,7 +26,6 @@ from sitegen.readme import (
|
||||
contributing_text,
|
||||
download_links,
|
||||
download_table,
|
||||
format_size,
|
||||
)
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
@@ -380,8 +380,8 @@ class SizesComeFromTheRecord(unittest.TestCase):
|
||||
if tag != RECORD.get("tag"):
|
||||
self.skipTest(f"release.json records {RECORD.get('tag')}, not {tag}")
|
||||
pack = releaserecord.pack_for(platform.lower(), RECORD)
|
||||
self.assertEqual(download, format_size(pack["download_size"]))
|
||||
self.assertEqual(extracted, format_size(pack["extracted_size"]))
|
||||
self.assertEqual(download, size_text(pack["download_size"]))
|
||||
self.assertEqual(extracted, size_text(pack["extracted_size"]))
|
||||
|
||||
|
||||
class ContributorChecksMatchCi(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user