Пример #1
0
def test_tab_map_long_str():
    """Pass."""
    long_str = "badwolf " * 30
    long_str_exp = (
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf\n"
        "badwolf badwolf badwolf"
    )
    value = {
        "title": long_str,
        "type": "string",
        "required": False,
    }
    exp = {
        "Title": long_str_exp,
        "Required": False,
        "Type": "string",
    }
    result = tab_map(value=value, key_map=KEY_MAP_SCHEMA)
    assert result == exp
Пример #2
0
def test_tab_map_orig_false():
    value = {
        "name": "schema_str",
        "type": "string",
        "required": False,
        "other": "bloop"
    }
    exp = {"Name": "schema_str", "Type": "string", "Required": False}
    result = tab_map(value=value, key_map=KEY_MAP_SCHEMA, orig=False)
    assert result == exp
Пример #3
0
def test_tab_map_list():
    long_str = ("badwolf " * 30).split(" ")
    long_str_exp = "\n".join(long_str)
    value = {
        "name": long_str,
        "type": "string",
        "required": False,
    }
    exp = {
        "Name": long_str_exp,
        "Required": False,
        "Type": "string",
    }
    result = tab_map(value=value, key_map=KEY_MAP_SCHEMA)
    assert result == exp
Пример #4
0
def test_tab_map_list_other():
    value = {
        "name": "schema_str",
        "type": "string",
        "required": False,
        "other": ["bloop", "floop"],
    }
    exp = {
        "Name": "schema_str",
        "Type": "string",
        "Required": False,
        "other": "bloop\nfloop",
    }
    result = tab_map(value=value, key_map=KEY_MAP_SCHEMA, orig=True)
    assert result == exp