Page MenuHomeSoftware Heritage

D4618.diff
No OneTemporary

D4618.diff

diff --git a/swh/indexer/tests/test_mimetype.py b/swh/indexer/tests/test_mimetype.py
--- a/swh/indexer/tests/test_mimetype.py
+++ b/swh/indexer/tests/test_mimetype.py
@@ -25,15 +25,18 @@
from swh.model.hashutil import hash_to_bytes
-def test_compute_mimetype_encoding():
- """Compute mimetype encoding should return results"""
- for _input, _mimetype, _encoding in [
+@pytest.mark.parametrize(
+ "raw_text,mimetype,encoding",
+ [
("du français".encode(), "text/plain", "utf-8"),
(b"def __init__(self):", "text/x-python", "us-ascii"),
(b"\xff\xfe\x00\x00\x00\x00\xff\xfe\xff\xff", "application/octet-stream", ""),
- ]:
- actual_result = compute_mimetype_encoding(_input)
- assert actual_result == {"mimetype": _mimetype, "encoding": _encoding}
+ ],
+)
+def test_compute_mimetype_encoding(raw_text, mimetype, encoding):
+ """Compute mimetype encoding should return results"""
+ actual_result = compute_mimetype_encoding(raw_text)
+ assert actual_result == {"mimetype": mimetype, "encoding": encoding}
CONFIG = {

File Metadata

Mime Type
text/plain
Expires
Jul 3 2025, 8:12 AM (10 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224333

Event Timeline