okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221A missing shard is named with its file name in the CLI, the TUI and the app's plain issues (TUI stress #9, C05, #3478)ea67f6999

main
1.7 KiB31 linesraw
1"""0.2.3 RC stress test #9 (C05, #3478): a missing shard is named, with its file name, in the CLI and in the TUI's own-files message."""
2
3from strata_control import models
4from tests.terminal.test_own_files import Base, Q2
5
6
7class MissingShardIsNamed(Base):
8    def test_the_plan_names_the_missing_second_shard(self):
9        folder = self.put(self.base / "half", Q2[:1], ["Q2_0"])
10        plan = models.plan_import(str(folder))
11        self.assertEqual(plan["issues"], ["incomplete_or_invalid_shard_set"])
12        self.assertEqual(len(plan["missing_shards"]), 1)
13        name = plan["missing_shards"][0]
14        self.assertRegex(name, r"-00002-of-0000[0-9]\.gguf$")
15        self.assertEqual(models.problem_words(plan["issues"], missing=plan["missing_shards"]), f"{name} is missing")
16        self.assertEqual(plan["plain_issues"], [f"{name} is missing"])
17
18    def test_without_a_name_the_old_sentence_stays(self):
19        self.assertEqual(models.problem_words(["incomplete_or_invalid_shard_set"]), "some parts of the model are missing")
20
21    def test_several_missing_shards_are_counted(self):
22        self.assertEqual(models.missing_words(["a-00002-of-00004.gguf", "a-00003-of-00004.gguf"]),
23                         "a-00002-of-00004.gguf and a-00003-of-00004.gguf are missing")
24        self.assertEqual(models.missing_words(["a-2", "a-3", "a-4", "a-5"]), "a-2, a-3 and 2 more files are missing")
25
26    def test_launch_plan_message_carries_the_file_name(self):
27        from tests.terminal.launch_support import run_cli
28        folder = self.put(self.base / "half2", Q2[:1], ["Q2_0"])
29        code, out, err = run_cli(["launch", "--plan", "--model-path", str(folder)])
30        self.assertNotEqual(code, 0)
31        self.assertRegex(err + out, r"-00002-of-0000[0-9]\.gguf is missing")