示例#1
0
def test_slugify_keep_uppercase():
    assert GetParams.slugify(
        s=UNSANITIZED,
        allowed_start=ascii_uppercase + ascii_lowercase,
        allowed_end=ascii_uppercase + ascii_lowercase + digits,
        allowed_rest=ascii_uppercase + ascii_lowercase + digits + "_",
        lower=False,
    ) == SLUG_KEEP_UPPERCASE
示例#2
0
def test_slugify_no_chars_allowed_at_end():
    assert GetParams.slugify(
        s=UNSANITIZED,
        allowed_end="",
    ) == ""
示例#3
0
def test_slugify_remove_uppercase():
    assert GetParams.slugify(
        s=UNSANITIZED,
        lower=False,
    ) == SLUG_UPPERCASE_REMOVED
示例#4
0
def test_slugify_wrong_type_whitespace_replace():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            whitespace_replace=LIST,
        )
示例#5
0
def test_slugify_no_whitespace():
    assert GetParams.slugify(
        s=UNSANITIZED,
        whitespace_replace="",
    ) == SLUG_WHITESPACE_REMOVED
示例#6
0
def test_slugify_wrong_type_lower():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            lower=LIST,
        )
示例#7
0
def test_slugify_wrong_type_allowed_rest():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            allowed_rest=LIST,
        )
示例#8
0
def test_slugify_wrong_type_s():
    with pytest.raises(TypeError):
        GetParams.slugify(s=LIST, )
示例#9
0
def test_slugify_okay():
    assert GetParams.slugify(s=UNSANITIZED, ) == SLUG_DEFAULT
示例#10
0
def test_slugify_no_args():
    with pytest.raises(TypeError):
        GetParams.slugify()