File size: 1,238 Bytes
c19ca42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import unittest
import importlib

utils = importlib.import_module("extensions.sd-webui-controlnet.tests.utils", "utils")

from scripts.infotext import parse_unit
from scripts.external_code import ControlNetUnit


class TestInfotext(unittest.TestCase):
    def test_parsing(self):
        infotext = (
            "Module: inpaint_only+lama, Model: control_v11p_sd15_inpaint [ebff9138], Weight: 1, "
            "Resize Mode: Resize and Fill, Low Vram: False, Guidance Start: 0, Guidance End: 1, "
            "Pixel Perfect: True, Control Mode: Balanced, Hr Option: Both, Save Detected Map: True"
        )
        self.assertEqual(
            vars(
                ControlNetUnit(
                    module="inpaint_only+lama",
                    model="control_v11p_sd15_inpaint [ebff9138]",
                    weight=1,
                    resize_mode="Resize and Fill",
                    low_vram=False,
                    guidance_start=0,
                    guidance_end=1,
                    pixel_perfect=True,
                    control_mode="Balanced",
                    hr_option="Both",
                    save_detected_map=True,
                )
            ),
            vars(parse_unit(infotext)),
        )