Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c589d1c

Browse files
committed
Move test_kaleido helper fns to top of file
1 parent 20035c6 commit c589d1c

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

‎tests/test_optional/test_kaleido/test_kaleido.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@
1616

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

19+
def create_figure(width=None, height=None):
20+
"""Create a simple figure with optional layout dimensions."""
21+
layout = {}
22+
if width:
23+
layout["width"] = width
24+
if height:
25+
layout["height"] = height
26+
27+
return go.Figure(data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])], layout=layout)
28+
29+
def parse_svg_dimensions(svg_bytes):
30+
"""Parse width and height from SVG bytes."""
31+
svg_str = svg_bytes.decode("utf-8")
32+
root = ET.fromstring(svg_str)
33+
width = root.get("width")
34+
height = root.get("height")
35+
return int(width) if width else None, int(height) if height else None
36+
1937

2038
def check_image(path_or_buffer, size=(700, 500), format="PNG"):
2139
if format == "PDF":
@@ -317,26 +335,6 @@ def test_get_chrome():
317335
mock_get_chrome.assert_called_once()
318336

319337

320-
def create_figure(width=None, height=None):
321-
"""Create a simple figure with optional layout dimensions."""
322-
layout = {}
323-
if width:
324-
layout["width"] = width
325-
if height:
326-
layout["height"] = height
327-
328-
return go.Figure(data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])], layout=layout)
329-
330-
331-
def parse_svg_dimensions(svg_bytes):
332-
"""Parse width and height from SVG bytes."""
333-
svg_str = svg_bytes.decode("utf-8")
334-
root = ET.fromstring(svg_str)
335-
width = root.get("width")
336-
height = root.get("height")
337-
return int(width) if width else None, int(height) if height else None
338-
339-
340338
def test_width_height_priority():
341339
"""Test width/height priority: arguments > layout.width/height > defaults."""
342340

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /