This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -14,7 +15,23 @@ class GenerateTrainingDataTests(unittest.TestCase):
|
||||
self.temp = tempfile.TemporaryDirectory()
|
||||
self.root = Path(self.temp.name)
|
||||
self.dictionary_dir = self.root / "dictionary"
|
||||
shutil.copytree(self.repo / "dictionary", self.dictionary_dir)
|
||||
self.dictionary_dir.mkdir()
|
||||
shutil.copy2(self.repo / "dictionary" / "static-base.json", self.dictionary_dir / "static-base.json")
|
||||
subprocess.run(
|
||||
[
|
||||
"cargo",
|
||||
"run",
|
||||
"--",
|
||||
"dictionary",
|
||||
"generate",
|
||||
"--out-dir",
|
||||
str(self.dictionary_dir),
|
||||
],
|
||||
cwd=self.repo,
|
||||
check=True,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
self.output_dir = self.root / "workspace_Data" / "data"
|
||||
self.output_dir.mkdir(parents=True)
|
||||
self.manifest = self.root / "workspace_Data" / "manifest.llm.json"
|
||||
@@ -96,6 +113,13 @@ class GenerateTrainingDataTests(unittest.TestCase):
|
||||
self.assertIn("codebook_checksum", dataset)
|
||||
self.assertTrue((self.output_dir / "module_controller_intents_1234567890" / "train.jsonl").exists())
|
||||
|
||||
def test_training_data_relative_path_prefers_custom_root_shape(self):
|
||||
path = Path("/Volumes/Zoe/custom-local-llm/training-data/module_controller_intents_123")
|
||||
self.assertEqual(
|
||||
bridge.relative_data_path(path),
|
||||
"training-data/module_controller_intents_123",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user