Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Romelium committed Feb 13, 2025
1 parent 0eb2583 commit a979ab9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/framesvg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ def create_animated_svg_string(frames: list[str], max_dims: dict[str, int], fps:

def save_svg_to_file(svg_string: str, output_path: str) -> None:
"""Writes SVG string to file."""
if os.path.isdir(output_path):
msg = "'%s' is a directory, not a file."
logging.exception(msg, output_path)
raise IsADirectoryError(msg, output_path)
try:
with open(output_path, "w", encoding="utf-8") as f:
f.write(svg_string)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def test_save_svg_to_file_errors(tmp_path, sample_svg_content):

output_directory = tmp_path / "output_dir"
output_directory.mkdir()
with pytest.raises(PermissionError):
with pytest.raises(IsADirectoryError):
save_svg_to_file(sample_svg_content, str(output_directory))


Expand All @@ -720,7 +720,7 @@ def test_convert_and_write_gif_to_animated_svg_integration(tmp_path):

output_directory = tmp_path / "output_dir"
output_directory.mkdir()
with pytest.raises(PermissionError):
with pytest.raises(IsADirectoryError):
convert_and_write_gif_to_animated_svg(gif_input_path, str(output_directory))


Expand Down

0 comments on commit a979ab9

Please sign in to comment.