Пример #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()