Skip to content

Commit 42118cd

Browse files
committed
Tighten docstring and test comments per /simplify review
1 parent 9b0cf72 commit 42118cd

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/spatialdata_plot/pl/render.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ def _reparse_points(
121121
) -> None:
122122
"""Re-register a points DataFrame in *sdata_filt* with its transformation.
123123
124-
When ``color_column`` is provided and refers to a column that
125-
``PointsModel.parse`` would silently drop because it collides with a
126-
reserved coordinate axis (e.g. a data column literally named ``"z"``),
127-
re-attach it so downstream color lookup can find it as a ``"df"`` origin.
124+
``PointsModel.parse`` silently drops columns whose names collide with
125+
reserved coordinate axes (currently only ``"z"``). When ``color_column``
126+
names such a column, re-attach it so downstream color lookup can find it.
128127
"""
129128
dd_frame = dask.dataframe.from_pandas(df, npartitions=1)
130129
parsed = PointsModel.parse(dd_frame, coordinates={"x": "x", "y": "y"})

tests/pl/test_render_points.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,7 @@ def test_no_table_fallback_warning_for_element_column(caplog):
10071007

10081008

10091009
def test_render_points_color_by_z_data_column():
1010-
# regression test for #615: a data column named "z" must remain usable
1011-
# for coloring. PointsModel.parse drops columns colliding with reserved
1012-
# coordinate names; _reparse_points must re-attach the requested color
1013-
# column when needed so color lookup does not crash.
1010+
# regression test for #615
10141011
pts = PointsModel.parse(
10151012
pd.DataFrame({"x": [1.0, 2.0, 3.0], "y": [1.0, 2.0, 3.0], "z": [0.1, 0.5, 0.9]}),
10161013
)
@@ -1024,9 +1021,7 @@ def test_render_points_color_by_z_data_column():
10241021

10251022

10261023
def test_render_points_color_by_z_with_extra_columns():
1027-
# #615 follow-up: re-attaching the color column must not disturb other
1028-
# data columns. Color by a non-conflicting column on a frame that also
1029-
# carries a (dropped-by-parse) "z" column.
1024+
# regression test for #615
10301025
pts = PointsModel.parse(
10311026
pd.DataFrame(
10321027
{

0 commit comments

Comments
 (0)