mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 08:32:07 -04:00
Reject non-string atomic text writes (#1819)
This commit is contained in:
@@ -138,6 +138,16 @@ def test_atomic_write_text_leaves_no_tmp_file(tmp_path):
|
||||
assert _tmp_siblings(tmp_path, "note.txt") == []
|
||||
|
||||
|
||||
def test_atomic_write_text_rejects_non_string_before_tmp_file(tmp_path):
|
||||
target = tmp_path / "note.txt"
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
atomic_write_text(str(target), 123)
|
||||
|
||||
assert not target.exists()
|
||||
assert _tmp_siblings(tmp_path, "note.txt") == []
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# atomic_write_text — failure path: target preserved when replace fails.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user