fix: stabilize Shopee cover replacement
This commit is contained in:
+12
-1
@@ -277,7 +277,18 @@ class AITests(TempDirMixin, unittest.TestCase):
|
||||
updated = db.list_tasks(batch_id=batch_id, path=cfg["db_path"])
|
||||
self.assertTrue(all(task.stage == "generated" for task in updated))
|
||||
self.assertEqual({"新旧标题A", "新旧标题B"}, {task.new_title for task in updated})
|
||||
self.assertTrue(all(task.new_cover_path.endswith("_new.jpg") for task in updated))
|
||||
expected_cover_paths = {
|
||||
os.path.abspath(
|
||||
os.path.join(
|
||||
cfg["image_dir"],
|
||||
str(task.batch_id),
|
||||
"main",
|
||||
f"{task.id}_{task.item_id}_new.jpg",
|
||||
)
|
||||
)
|
||||
for task in updated
|
||||
}
|
||||
self.assertEqual(expected_cover_paths, {task.new_cover_path for task in updated})
|
||||
self.assertTrue(all(os.path.exists(task.new_cover_path) for task in updated))
|
||||
self.assertIn("主店", "\n".join(cover_prompts))
|
||||
self.assertIn("新旧标题A", "\n".join(cover_prompts))
|
||||
|
||||
Reference in New Issue
Block a user