test: add neither-axis-LR edge case + document swap pass-through

main
Sven Geboers 1 month ago
parent 74b3f10d07
commit 9d219d63ee
  1. 1
      explorer.py
  2. 7
      tests/test_political_compass.py

@ -193,6 +193,7 @@ def _swap_axes(
new_positions[wid] = {ent: (y, x) for ent, (x, y) in pos_dict.items()}
new_ax = dict(axis_def)
# Non-paired keys pass through unchanged
# Swap paired scalar keys
new_ax["x_label"] = axis_def.get("y_label")
new_ax["y_label"] = axis_def.get("x_label")

@ -724,3 +724,10 @@ def test_axis_swap_not_applied_when_x_is_left_right():
"y_label": "Links\u2013Rechts", # both LR — no swap
}
assert _should_swap_axes(axis_def2) is False
def test_axis_swap_not_applied_when_neither_axis_is_left_right():
from explorer import _should_swap_axes
assert _should_swap_axes({"x_label": "Foo", "y_label": "Bar"}) is False
assert _should_swap_axes({"x_label": None, "y_label": None}) is False

Loading…
Cancel
Save