예제 #1
0
def test__valid_config(styles: List[Style]) -> None:

    data = {
        Key.PARENT_CLASSES: [
            "parent-style",
        ],
        Key.STYLES: [
            {
                Key.NAME: "Style0",
                Key.MARKUP: "*",
                Key.CLASSES: ["style0"],
            },
            {
                Key.NAME: "Style1",
                Key.MARKUP: "**",
                Key.CLASSES: ["style1"],
            },
            {
                Key.NAME: "Style2",
                Key.MARKUP: "~",
                Key.CLASSES: ["style2"],
            },
            {
                Key.NAME: "Style3",
                Key.MARKUP: "~~",
                Key.CLASSES: ["style3"],
            },
        ],
    }

    config = Config(data=data)

    assert config.styles == styles
예제 #2
0
def test__markup_blank() -> None:

    data = {
        Key.STYLES: [
            {
                Key.NAME: "Style",
                Key.MARKUP: "",
                Key.CLASSES: ["style"],
            },
        ]
    }

    with pytest.raises(ConfigError):
        Config(data=data)
예제 #3
0
def test__missing_markup() -> None:

    data = {
        Key.STYLES: [
            {
                Key.NAME: "Style",
                # MISSING MARKUP
                Key.CLASSES: ["style"],
            },
        ]
    }

    with pytest.raises(ConfigError):
        Config(data=data)
예제 #4
0
def test__missing_classes() -> None:

    data = {
        Key.STYLES: [
            {
                Key.NAME: "Style",
                Key.MARKUP: "*",
                # MISSING CLASSES
            },
        ]
    }

    with pytest.raises(ConfigError):
        Config(data=data)
예제 #5
0
def test__missing_name() -> None:

    data = {
        Key.STYLES: [
            {
                # MISSING NAME
                Key.MARKUP: "*",
                Key.CLASSES: ["style"],
            },
        ]
    }

    with pytest.raises(ConfigError):
        Config(data=data)