Keep dashboard category identity separate from shortened labels

This commit is contained in:
Andras Schmelczer 2026-10-27 20:07:36 +00:00
commit 774546a2c4

View file

@ -1,7 +1,8 @@
from typing import Any
import pandas as pd
import pytest
from great_ai.deploy.routes.dashboard.create_dash_app import get_dimension_descriptor
from great_ai.deploy.routes.dashboard.get_filter_from_datatable import (
get_filter_from_datatable,
)
@ -30,3 +31,13 @@ def test_dashboard_filter_grammar(expression: str, operator: str, value: Any) ->
)
def test_incomplete_filters_are_ignored(expression: str) -> None:
assert get_filter_from_datatable(expression) is None
def test_long_category_labels_keep_distinct_coordinates() -> None:
prefix = "a" * 40
dimension = get_dimension_descriptor(
pd.DataFrame({"category": [prefix + "1", prefix + "2"]}), "category"
)
assert dimension["values"] == [0, 1]
assert dimension["tickvals"] == [0, 1]
assert dimension["ticktext"] == [prefix, prefix]