From eff77ff2486bc98f7a21cbbd67d2ff12492e1752 Mon Sep 17 00:00:00 2001 From: "_its.just.regi_" Date: Mon, 21 Jul 2025 18:48:57 -0400 Subject: [PATCH] test: validate dataset jsonl contents --- tests/test_main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index 7a2d476..398cd49 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -142,6 +142,18 @@ def test_process_images_output(runner, temp_dir): jsonl_file = os.path.join(temp_dir, "dataset.jsonl") assert os.path.exists(jsonl_file), f"Expected JSONL file not found: {jsonl_file}" + # Validate JSONL contents + entries = [] + with open(jsonl_file, "r") as f: + for line in f: + if line.strip(): + entries.append(json.loads(line)) + + assert len(entries) == num_images + for entry in entries: + for key in ["image", "text", "mask_path"]: + assert key in entry + # Print the final contents of the output directory print("\nFinal contents of output directory:") for file in os.listdir(temp_dir):