Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move test_kaleido helper fns to top of file
  • Loading branch information
ayjayt committed Aug 18, 2025
commit c589d1c5bb0fb3ea07149016581b2c4040168c55
38 changes: 18 additions & 20 deletions tests/test_optional/test_kaleido/test_kaleido.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@

fig = {"data": [], "layout": {"title": {"text": "figure title"}}}

def create_figure(width=None, height=None):
"""Create a simple figure with optional layout dimensions."""
layout = {}
if width:
layout["width"] = width
if height:
layout["height"] = height

return go.Figure(data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])], layout=layout)

def parse_svg_dimensions(svg_bytes):
"""Parse width and height from SVG bytes."""
svg_str = svg_bytes.decode("utf-8")
root = ET.fromstring(svg_str)
width = root.get("width")
height = root.get("height")
return int(width) if width else None, int(height) if height else None


def check_image(path_or_buffer, size=(700, 500), format="PNG"):
if format == "PDF":
Expand Down Expand Up @@ -317,26 +335,6 @@ def test_get_chrome():
mock_get_chrome.assert_called_once()


def create_figure(width=None, height=None):
"""Create a simple figure with optional layout dimensions."""
layout = {}
if width:
layout["width"] = width
if height:
layout["height"] = height

return go.Figure(data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])], layout=layout)


def parse_svg_dimensions(svg_bytes):
"""Parse width and height from SVG bytes."""
svg_str = svg_bytes.decode("utf-8")
root = ET.fromstring(svg_str)
width = root.get("width")
height = root.get("height")
return int(width) if width else None, int(height) if height else None


def test_width_height_priority():
"""Test width/height priority: arguments > layout.width/height > defaults."""

Expand Down