| 69 | |
| 70 | |
| 71 | def test_labels(backend): |
| 72 | tips = nw.from_native(px.data.tips(return_type=backend)) |
| 73 | fig = px.scatter( |
| 74 | tips.to_native(), |
| 75 | x="total_bill", |
| 76 | y="tip", |
| 77 | facet_row="time", |
| 78 | facet_col="day", |
| 79 | color="size", |
| 80 | symbol="sex", |
| 81 | labels={c: c.upper() for c in tips.columns}, |
| 82 | ) |
| 83 | assert "SEX" in fig.data[0].hovertemplate |
| 84 | assert "TOTAL_BILL" in fig.data[0].hovertemplate |
| 85 | assert "SIZE" in fig.data[0].hovertemplate |
| 86 | assert "DAY" in fig.data[0].hovertemplate |
| 87 | assert "TIME" in fig.data[0].hovertemplate |
| 88 | assert fig.layout.legend.title.text.startswith("SEX") |
| 89 | assert fig.layout.xaxis.title.text == "TOTAL_BILL" |
| 90 | assert fig.layout.coloraxis.colorbar.title.text == "SIZE" |
| 91 | assert fig.layout.annotations[0].text.startswith("DAY") |
| 92 | assert fig.layout.annotations[4].text.startswith("TIME") |
| 93 | |
| 94 | |
| 95 | @pytest.mark.parametrize( |