From 98768b16a7ee304f230de5adb62f511ef0b2fb70 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Mon, 14 Jul 2025 13:09:32 +0200 Subject: [PATCH] Update tests/test_io_utils.py --- tests/test_io_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_io_utils.py b/tests/test_io_utils.py index d1b5e2a0..d144ee3c 100644 --- a/tests/test_io_utils.py +++ b/tests/test_io_utils.py @@ -11,24 +11,24 @@ def test_read_file(tmp_path): # Write and read file, normal operation file = tmp_path / "test.txt" file.write_text("hello") - content = io_utils.read_file(str(file)) + content = read_file(str(file)) assert content == "hello" def test_write_file(tmp_path): # Write content to file and verify write success file = tmp_path / "test_write.txt" - io_utils.write_file(str(file), "data") + write_file(str(file), "data") assert file.read_text() == "data" def test_cause_io_error(): # Raises manual IOError to simulate IO failure with pytest.raises(IOError): - io_utils.cause_io_error() + cause_io_error() def test_file_not_found(): # Reading non-existing file raises FileNotFoundError with pytest.raises(FileNotFoundError): - io_utils.read_file("nonexistent.file") + read_file("nonexistent.file") def test_permission_error(monkeypatch): # Patch open to raise PermissionError simulating access denial @@ -36,7 +36,7 @@ def test_permission_error(monkeypatch): raise PermissionError("Permission denied") monkeypatch.setattr("builtins.open", raise_perm_error) with pytest.raises(PermissionError): - io_utils.read_file("anyfile.txt") + read_file("anyfile.txt") def test_mock_open_error(monkeypatch): # Mock open() to raise IOError simulating read error