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 1b962ec

Browse files
committed
Fix test formatting.
1 parent f1e7607 commit 1b962ec

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

‎tests/test_optional/test_kaleido/test_kaleido.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,19 @@ def create_figure(width=None, height=None):
321321
"""Create a simple figure with optional layout dimensions."""
322322
layout = {}
323323
if width:
324-
layout['width'] = width
324+
layout["width"] = width
325325
if height:
326-
layout['height'] = height
326+
layout["height"] = height
327327

328-
return go.Figure(
329-
data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])],
330-
layout=layout
331-
)
328+
return go.Figure(data=[go.Scatter(x=[1, 2, 3], y=[1, 2, 3])], layout=layout)
332329

333330

334331
def parse_svg_dimensions(svg_bytes):
335332
"""Parse width and height from SVG bytes."""
336-
svg_str = svg_bytes.decode('utf-8')
333+
svg_str = svg_bytes.decode("utf-8")
337334
root = ET.fromstring(svg_str)
338-
width = root.get('width')
339-
height = root.get('height')
335+
width = root.get("width")
336+
height = root.get("height")
340337
return int(width) if width else None, int(height) if height else None
341338

342339

@@ -345,24 +342,32 @@ def test_width_height_priority():
345342

346343
# Test case 1: Arguments override layout
347344
fig = create_figure(layout_width=800, layout_height=600)
348-
svg_bytes = pio.to_image(fig, format='svg', width=1000, height=900)
345+
svg_bytes = pio.to_image(fig, format="svg", width=1000, height=900)
349346
width, height = parse_svg_dimensions(svg_bytes)
350-
assert width == 1000 and height == 900, "Arguments should override layout dimensions"
347+
assert width == 1000 and height == 900, (
348+
"Arguments should override layout dimensions"
349+
)
351350

352351
# Test case 2: Layout dimensions used when no arguments
353352
fig = create_figure(layout_width=800, layout_height=600)
354-
svg_bytes = pio.to_image(fig, format='svg')
353+
svg_bytes = pio.to_image(fig, format="svg")
355354
width, height = parse_svg_dimensions(svg_bytes)
356-
assert width == 800 and height == 600, "Layout dimensions should be used when no arguments provided"
355+
assert width == 800 and height == 600, (
356+
"Layout dimensions should be used when no arguments provided"
357+
)
357358

358359
# Test case 3: Partial override (only width argument)
359360
fig = create_figure(layout_width=800, layout_height=600)
360-
svg_bytes = pio.to_image(fig, format='svg', width=1200)
361+
svg_bytes = pio.to_image(fig, format="svg", width=1200)
361362
width, height = parse_svg_dimensions(svg_bytes)
362-
assert width == 1200 and height == 600, "Width argument should override layout, height should use layout"
363+
assert width == 1200 and height == 600, (
364+
"Width argument should override layout, height should use layout"
365+
)
363366

364367
# Test case 4: Defaults used when no layout or arguments
365368
fig = create_figure()
366-
svg_bytes = pio.to_image(fig, format='svg')
369+
svg_bytes = pio.to_image(fig, format="svg")
367370
width, height = parse_svg_dimensions(svg_bytes)
368-
assert width is not None and height is not None, "Default dimensions should be used when no layout or arguments"
371+
assert width is not None and height is not None, (
372+
"Default dimensions should be used when no layout or arguments"
373+
)

0 commit comments

Comments
(0)

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