Skip to content

Commit

Permalink
refactor(svg): Rename save_drawing to just save
Browse files Browse the repository at this point in the history
Shorter and everybody still knows what it does.
  • Loading branch information
ewuerger committed Jan 16, 2024
1 parent 3d3458b commit 03aced7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion capellambse/svg/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,18 @@ def draw_object(self, obj: ContentsDict) -> None:
"""Draw the given ``obj`` on the underlaying ``Drawing``."""
self.drawing.draw_object(obj)

def save_drawing(
def save_drawing(self, *args, **kwargs) -> None:
import warnings

warnings.warn(
"'save_drawing' is deprecated, use 'save' instead",
DeprecationWarning,
stacklevel=2,
)
del warnings
self.save(*args, **kwargs)

def save(
self,
filename: str | None = None,
pretty: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def tmp_svg(self, tmp_path: pathlib.Path) -> SVGDiagram:
return svg

def test_diagram_saves(self, tmp_svg: SVGDiagram) -> None:
tmp_svg.save_drawing()
tmp_svg.save()
assert pathlib.Path(tmp_svg.drawing.filename).is_file()

def test_base_css_styles(self, tmp_json: pathlib.Path) -> None:
Expand Down

0 comments on commit 03aced7

Please sign in to comment.