Skip to content

Commit ec677f4

Browse files
committed
cuda.bindings: trim strdecode tests to behavior-pinning set
Drop tests that verified stdlib behavior or trivial format strings; keep the 11 that pin a non-obvious invariant (issue spec, codec/position preservation, NUL/cap markers). Signed-off-by: Aryan Putta <aryansputta@gmail.com>
1 parent 3eb70d1 commit ec677f4

1 file changed

Lines changed: 0 additions & 26 deletions

File tree

cuda_bindings/tests/test_strdecode.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ def test_valid_utf8_passthrough():
1212
assert decode_c_str(b"hello world", "fakeApi") == "hello world"
1313

1414

15-
def test_empty_input():
16-
assert decode_c_str(b"", "fakeApi") == ""
17-
18-
19-
def test_multibyte_utf8_passthrough():
20-
assert decode_c_str(b"caf\xc3\xa9", "fakeApi") == "café"
21-
22-
2315
def test_invalid_bytes_raise_unicode_decode_error():
2416
with pytest.raises(UnicodeDecodeError):
2517
decode_c_str(WSL_MOJIBAKE_PREFIX, "nvmlSystemGetProcessName")
@@ -59,18 +51,6 @@ def test_preview_stops_at_first_nul():
5951
assert "stopped at NUL@2" in preview
6052

6153

62-
def test_preview_with_leading_nul_reports_zero_bytes_and_nul_marker():
63-
preview = _bounded_hex_preview(b"\x00\xf8\xf8")
64-
assert preview.startswith("<0 bytes;")
65-
assert "hex=''" in preview
66-
assert "stopped at NUL@0" in preview
67-
68-
69-
def test_preview_no_nul_no_truncation_has_no_suffix():
70-
preview = _bounded_hex_preview(b"\xf8\x9a")
71-
assert preview == "<2 bytes; hex='f8 9a'>"
72-
73-
7454
def test_preview_caps_long_buffers():
7555
preview = _bounded_hex_preview(b"\xf8" * 200, max_bytes=8)
7656
assert "f8 f8 f8 f8 f8 f8 f8 f8" in preview
@@ -84,18 +64,12 @@ def test_preview_combines_truncation_and_nul_markers():
8464
assert "stopped at NUL@20" in preview
8565

8666

87-
def test_preview_empty_input():
88-
assert _bounded_hex_preview(b"") == "<0 bytes; hex=''>"
89-
90-
9167
def test_failure_preview_stops_at_embedded_nul_even_with_bad_bytes_before():
92-
# C-string convention: helper reports what NVML would treat as the string.
9368
with pytest.raises(UnicodeDecodeError) as excinfo:
9469
decode_c_str(b"\xf8\x9a\x00ignored_after_nul", "fakeApi")
9570
reason = excinfo.value.reason
9671
assert "f8 9a" in reason
9772
assert "ignored_after_nul" not in reason
98-
assert "<2 bytes;" in reason
9973

10074

10175
def test_failure_message_stays_bounded_for_long_garbage():

0 commit comments

Comments
 (0)