Skip to content

Commit d923ae4

Browse files
committed
Final unit test for extract()
Signed-off-by: Bram Stoeller <bram.stoeller@alliander.com>
1 parent f86c7e1 commit d923ae4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/unit/utils/test_zip_files.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ def test_extract__invalid_file_extension():
6363
extract(src_file_path=Path("/tmp/dir/tempfile.download"))
6464

6565

66+
def test_extract__invalid_dst_dir(temp_dir: Path):
67+
# Arrange
68+
with open(temp_dir / "notadir.txt", "wb"):
69+
pass
70+
71+
# Act / Assert
72+
with pytest.raises(NotADirectoryError, match=r"Destination dir .*notadir\.txt exists and is not a directory"):
73+
extract(src_file_path=Path("file.zip"), dst_dir_path=temp_dir / "notadir.txt")
74+
75+
6676
@patch("power_grid_model_io.utils.download.tqdm")
6777
def test_extract__file_exists(mock_tqdm: MagicMock, temp_dir: Path):
6878
# Arrange

0 commit comments

Comments
 (0)