Show the size of the code each finished item names beside its S in score-outcomes

This commit is contained in:
2026-11-08 23:10:55 +01:00
parent 0a9a4dc159
commit 6176f72355
10 changed files with 150 additions and 42 deletions
+35
View File
@@ -0,0 +1,35 @@
import pathlib
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from release_plan.named_code import named_files, named_paths
class NamedPaths(unittest.TestCase):
def test_names_each_tracked_file_or_folder_a_backticked_span_names_once_with_its_files(self):
cases = (
("`src/` and `src`", ["src/app.py", "srcfoo/x.py"], [("src", 1)]),
("`src/`", ["src/app.py", "src/b.py"], [("src", 2)]),
("`src/app.py`, `gone.py` and `run`", ["src/app.py"], [("src/app.py", 1)]),
)
for text, tracked, named in cases:
with self.subTest(text=text):
self.assertEqual(named_paths(text, tracked), named)
class NamedFiles(unittest.TestCase):
def test_lists_each_tracked_file_a_span_names_by_itself_or_its_folder_once(self):
cases = (
("`src` and `src/a.py`", ["b.py", "src/a.py", "src/b.py", "srcfoo/x.py"], ["src/a.py", "src/b.py"]),
("`b.py`, `gone.py` and `run`", ["b.py", "c.py"], ["b.py"]),
("no span", ["b.py"], []),
)
for text, tracked, named in cases:
with self.subTest(text=text):
self.assertEqual(named_files(text, tracked), named)
if __name__ == "__main__":
unittest.main()