def test_sanitize_filename_empty_replacement(): name = '/<Bad File>/' assert utils.sanitize_filename(name, replacement=None) == 'Bad File'
def test_sanitize_filename(inp, expected): assert utils.sanitize_filename(inp) == expected
def test_invariants(self, filename): sanitized = utils.sanitize_filename(filename, shorten=True) assert len(os.fsencode(sanitized)) <= 255 - len("(123).download")
def test_shorten(self, inp, expected): assert utils.sanitize_filename(inp, shorten=True) == expected
def test_special_chars(self, inp, expected): assert utils.sanitize_filename(inp) == expected
def test_sanitize_filename(inp, expected, monkeypatch): assert utils.sanitize_filename(inp) == expected