build(deps): drop unused crccheck, jsonpath-ng, PyExecJS and chardet

This commit is contained in:
imSp4rky
2026-11-25 15:23:40 -07:00
parent 8769ad4031
commit 5ba0a5474c
5 changed files with 32 additions and 65 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
"""Unit tests for manifest response decoding. Reading `.text` on a response with no encoding
makes requests run chardet over the whole body, so the playlist fetch paths set utf-8
makes requests run charset detection over the whole body, so the playlist fetch paths set utf-8
first. A charset the server did send must survive. An MPD is parsed from bytes, so the
XML declaration gives the encoding."""
+28
View File
@@ -0,0 +1,28 @@
"""Unit tests for try_ensure_utf8."""
from __future__ import annotations
import gzip
import pytest
from unshackle.core.utilities import try_ensure_utf8
pytestmark = pytest.mark.unit
def test_utf8_input_is_returned_unchanged() -> None:
data = "caf\u00e9 \u2014 \u65e5\u672c".encode("utf8")
assert try_ensure_utf8(data) is data
def test_cp1252_input_is_converted_to_utf8() -> None:
assert try_ensure_utf8(b"caf\xe9 \x93q\x94") == "caf\u00e9 \u201cq\u201d".encode("utf8")
def test_bytes_undefined_in_cp1252_become_replacement_characters() -> None:
assert try_ensure_utf8(b"a\x81\x8d\x8f\x90\x9db") == ("a" + "\ufffd" * 5 + "b").encode("utf8")
def test_gzip_input_is_decompressed_first() -> None:
assert try_ensure_utf8(gzip.compress(b"caf\xe9")) == "caf\u00e9".encode("utf8")