Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9337652
D4618.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D4618.diff
View Options
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
Details
Attached
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
Attached To
D4618: test_mimetype: Refactor test to use pytest.mark.parametrize
Event Timeline
Log In to Comment