Bump version to 0.8.2; enhance image parameter extraction
Some checks failed
Gitea/kapitanbooru-uploader/pipeline/head There was a failure building this commit
Some checks failed
Gitea/kapitanbooru-uploader/pipeline/head There was a failure building this commit
This commit is contained in:
96
tests/test_tags.py
Normal file
96
tests/test_tags.py
Normal file
@ -0,0 +1,96 @@
|
||||
import unittest
|
||||
from kapitanbooru_uploader import tag_processing
|
||||
|
||||
|
||||
class TestTagProcessing(unittest.TestCase):
|
||||
def test_PARAMETERS_PATTERN(self):
|
||||
# Test for a valid tag with parameters
|
||||
test_data = [
|
||||
r"""masterpiece,best quality,amazing quality,explicit,1girl,cat ears,animal ear fluff,very short hair,messy hair,two-tone hair,streaked hair,red streaks,black hair,orange eyes,slit pupils,tan,tomboy,blush,heart,muscular female,pussy,nipples,thick thighs,wide hips,completely nude,black choker,fingernails,bracelet,emo fashion,black nails,outdoors, depth of field,cowboy shot,<lora:HYPv1-2:1>,colossal breasts,looking at viewer,seductive smile,tall female,(from below), colossal thighs,aroused,lactation,excessive lactation, pussy juice,
|
||||
Negative prompt: bad quality,worst quality,worst detail,sketch,censor
|
||||
Steps: 28, Sampler: Euler a, Schedule type: Automatic, CFG scale: 5, Seed: 1508055966, Size: 768x1344, Model hash: 89cb4ec0a9, Model: waiNSFWIllustrious_v120, Denoising strength: 0.4, Clip skip: 2, Hires CFG Scale: 5, Hires upscale: 2, Hires steps: 30, Hires upscaler: R-ESRGAN 4x+ Anime6B, Lora hashes: "LowRA: 0dfc93870ba3, add-detail-xl: 9c783c8ce46c, badhands: 96b1245a1ab8", Version: f1.7.0-v1.10.1RC-latest-2164-g9535244a""",
|
||||
r"""1girl, nekomata okayu, hololive, nsfw,
|
||||
simple background,
|
||||
solo, looking at viewer, seductive smile, huge breasts, sexually suggestive,
|
||||
full body, dutch angle,
|
||||
masterpiece, high score, great score, absurdres
|
||||
Negative prompt: lowres, bad anatomy, bad hands, text, error, missing finger, extra digits, fewer digits, cropped, worst quality, low quality, low score, bad score, average score, signature, watermark, username, blurry
|
||||
Steps: 28, Sampler: Euler a, Schedule type: Automatic, CFG scale: 5, Seed: 520762214, Size: 768x1344, Model hash: 6327eca98b, Model: animagine-xl-4.0-opt, Denoising strength: 0.4, Hires CFG Scale: 5, Hires upscale: 2, Hires steps: 30, Hires upscaler: R-ESRGAN 4x+ Anime6B, Version: f1.7.0-v1.10.1RC-latest-2164-g9535244a""",
|
||||
r"""score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, a girl with medium breasts and gigantic thighs standing at a gym wearing black sports bra and black yoga pants, 1girl, medium breasts, standing, gym, black sports bra, black pants, yoga pants
|
||||
Steps: 28, Sampler: Euler a, Schedule type: Automatic, CFG scale: 5, Seed: 3876891898, Size: 768x1344, Model hash: 67ab2fd8ec, Model: ponyDiffusionV6XL_v6StartWithThisOne, Denoising strength: 0.4, Clip skip: 2, Hires CFG Scale: 5, Hires upscale: 2, Hires steps: 30, Hires upscaler: R-ESRGAN 4x+ Anime6B, Version: f1.7.0-v1.10.1RC-latest-2164-g9535244a""",
|
||||
]
|
||||
expected = [
|
||||
{
|
||||
"prompt": r"""masterpiece,best quality,amazing quality,explicit,1girl,cat ears,animal ear fluff,very short hair,messy hair,two-tone hair,streaked hair,red streaks,black hair,orange eyes,slit pupils,tan,tomboy,blush,heart,muscular female,pussy,nipples,thick thighs,wide hips,completely nude,black choker,fingernails,bracelet,emo fashion,black nails,outdoors, depth of field,cowboy shot,<lora:HYPv1-2:1>,colossal breasts,looking at viewer,seductive smile,tall female,(from below), colossal thighs,aroused,lactation,excessive lactation, pussy juice""",
|
||||
"negative_prompt": "bad quality,worst quality,worst detail,sketch,censor",
|
||||
"steps": "28",
|
||||
"sampler": "Euler a",
|
||||
"schedule_type": "Automatic",
|
||||
"cfg_scale": "5",
|
||||
"seed": "1508055966",
|
||||
"size": "768x1344",
|
||||
"model_hash": "89cb4ec0a9",
|
||||
"model": "waiNSFWIllustrious_v120",
|
||||
"denoising_strength": "0.4",
|
||||
"clip_skip": "2",
|
||||
"hires_cfg_scale": "5",
|
||||
"hires_upscale": "2",
|
||||
"hires_steps": "30",
|
||||
"hires_upscaler": "R-ESRGAN 4x+ Anime6B",
|
||||
"lora_hashes": "LowRA: 0dfc93870ba3, add-detail-xl: 9c783c8ce46c, badhands: 96b1245a1ab8",
|
||||
"version": "f1.7.0-v1.10.1RC-latest-2164-g9535244a",
|
||||
},
|
||||
{
|
||||
"prompt": r"""1girl, nekomata okayu, hololive, nsfw,
|
||||
simple background,
|
||||
solo, looking at viewer, seductive smile, huge breasts, sexually suggestive,
|
||||
full body, dutch angle,
|
||||
masterpiece, high score, great score, absurdres""",
|
||||
"negative_prompt": "lowres, bad anatomy, bad hands, text, error, missing finger, extra digits, fewer digits, cropped, worst quality, low quality, low score, bad score, average score, signature, watermark, username, blurry",
|
||||
"steps": "28",
|
||||
"sampler": "Euler a",
|
||||
"schedule_type": "Automatic",
|
||||
"cfg_scale": "5",
|
||||
"seed": "520762214",
|
||||
"size": "768x1344",
|
||||
"model_hash": "6327eca98b",
|
||||
"model": "animagine-xl-4.0-opt",
|
||||
"denoising_strength": "0.4",
|
||||
"clip_skip": None,
|
||||
"hires_cfg_scale": "5",
|
||||
"hires_upscale": "2",
|
||||
"hires_steps": "30",
|
||||
"hires_upscaler": "R-ESRGAN 4x+ Anime6B",
|
||||
"lora_hashes": None,
|
||||
"version": "f1.7.0-v1.10.1RC-latest-2164-g9535244a",
|
||||
},
|
||||
{
|
||||
"prompt": r"""score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up, a girl with medium breasts and gigantic thighs standing at a gym wearing black sports bra and black yoga pants, 1girl, medium breasts, standing, gym, black sports bra, black pants, yoga pants""",
|
||||
"negative_prompt": None,
|
||||
"steps": "28",
|
||||
"sampler": "Euler a",
|
||||
"schedule_type": "Automatic",
|
||||
"cfg_scale": "5",
|
||||
"seed": "3876891898",
|
||||
"size": "768x1344",
|
||||
"model_hash": "67ab2fd8ec",
|
||||
"model": "ponyDiffusionV6XL_v6StartWithThisOne",
|
||||
"denoising_strength": "0.4",
|
||||
"clip_skip": "2",
|
||||
"hires_cfg_scale": "5",
|
||||
"hires_upscale": "2",
|
||||
"hires_steps": "30",
|
||||
"hires_upscaler": "R-ESRGAN 4x+ Anime6B",
|
||||
"lora_hashes": None,
|
||||
"version": "f1.7.0-v1.10.1RC-latest-2164-g9535244a",
|
||||
},
|
||||
]
|
||||
for i, tag in enumerate(test_data):
|
||||
with self.subTest(i=i):
|
||||
result = tag_processing.PARAMETERS_PATTERN.search(tag)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result.groupdict(), expected[i])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Reference in New Issue
Block a user