File: test_string_utils.py

package info (click to toggle)
python-whitenoise 6.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 472 kB
  • sloc: python: 2,040; makefile: 132; javascript: 10
file content (23 lines) | stat: -rw-r--r-- 673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

from whitenoise.string_utils import ensure_leading_trailing_slash


class EnsureLeadingTrailingSlashTests:
    def test_none(self):
        assert ensure_leading_trailing_slash(None) == "/"

    def test_empty(self):
        assert ensure_leading_trailing_slash("") == "/"

    def test_slash(self):
        assert ensure_leading_trailing_slash("/") == "/"

    def test_contents(self):
        assert ensure_leading_trailing_slash("/foo/") == "/foo/"

    def test_leading(self):
        assert ensure_leading_trailing_slash("/foo") == "/foo"

    def test_trailing(self):
        assert ensure_leading_trailing_slash("foo/") == "/foo"