Example #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
Example #2
0
def test_slugify_no_chars_allowed_at_end():
    assert GetParams.slugify(
        s=UNSANITIZED,
        allowed_end="",
    ) == ""
Example #3
0
def test_slugify_remove_uppercase():
    assert GetParams.slugify(
        s=UNSANITIZED,
        lower=False,
    ) == SLUG_UPPERCASE_REMOVED
Example #4
0
def test_slugify_wrong_type_whitespace_replace():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            whitespace_replace=LIST,
        )
Example #5
0
def test_slugify_no_whitespace():
    assert GetParams.slugify(
        s=UNSANITIZED,
        whitespace_replace="",
    ) == SLUG_WHITESPACE_REMOVED
Example #6
0
def test_slugify_wrong_type_lower():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            lower=LIST,
        )
Example #7
0
def test_slugify_wrong_type_allowed_rest():
    with pytest.raises(TypeError):
        GetParams.slugify(
            s=UNSANITIZED,
            allowed_rest=LIST,
        )
Example #8
0
def test_slugify_wrong_type_s():
    with pytest.raises(TypeError):
        GetParams.slugify(s=LIST, )
Example #9
0
def test_slugify_okay():
    assert GetParams.slugify(s=UNSANITIZED, ) == SLUG_DEFAULT
Example #10
0
def test_slugify_no_args():
    with pytest.raises(TypeError):
        GetParams.slugify()