예제 #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()