From e2db9a6ce5a36371f6d4a63cb4fece836aa9cfe2 Mon Sep 17 00:00:00 2001 From: palewire Date: Fri, 14 Nov 2025 17:00:36 -0500 Subject: [PATCH] refactor(bar): rename 'thick' field to 'thick_bars' for clarity Renamed the `thick` field to `thick_bars` in the BarChart class to improve code readability and make the field name more descriptive. The field still uses "thick" as an alias to maintain backward compatibility with the API. Changes: - Renamed field from `thick` to `thick_bars` in BarChart model - Updated all references in serialization and deserialization methods - Updated test assertions to use new field name This change makes the codebase more maintainable by using a more explicit field name while preserving the existing API contract through aliasing. --- datawrapper/charts/bar.py | 6 +++--- tests/functional/test_end_to_end.py | 6 +++--- tests/integration/test_chart_get_method.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/datawrapper/charts/bar.py b/datawrapper/charts/bar.py index 3fbbd591..8d1668d6 100644 --- a/datawrapper/charts/bar.py +++ b/datawrapper/charts/bar.py @@ -315,7 +315,7 @@ class BarChart(AnnotationsMixin, BaseChart): ) #: Make the bars thicker - thick: bool = Field( + thick_bars: bool = Field( default=False, alias="thick", description="Make the bars thicker" ) @@ -432,7 +432,7 @@ def serialize_model(self) -> dict: ), "color-by-column": bool(self.color_category), "rules": self.rules, - "thick": self.thick, + "thick": self.thick_bars, "background": self.background, # Sorting and grouping "sort-bars": self.sort_bars, @@ -563,7 +563,7 @@ def deserialize_model(cls, api_response: dict[str, Any]) -> dict[str, Any]: if "rules" in visualize: init_data["rules"] = visualize["rules"] if "thick" in visualize: - init_data["thick"] = visualize["thick"] + init_data["thick_bars"] = visualize["thick"] if "background" in visualize: init_data["background"] = visualize["background"] diff --git a/tests/functional/test_end_to_end.py b/tests/functional/test_end_to_end.py index 91bcf0c8..47d11af3 100644 --- a/tests/functional/test_end_to_end.py +++ b/tests/functional/test_end_to_end.py @@ -158,7 +158,7 @@ def test_chart_customization_workflow(self, sample_dataframe): bar_column="values", base_color="#4682B4", background=True, - thick=True, + thick_bars=True, ) # Step 2: Apply advanced customizations @@ -180,7 +180,7 @@ def test_chart_customization_workflow(self, sample_dataframe): # Step 4: Verify customizations are applied assert chart.base_color == "#4682B4" assert chart.background is True - assert chart.thick is True + assert chart.thick_bars is True assert chart.sort_bars is True assert chart.reverse_order is True assert chart.custom_range == (0, 100) @@ -324,7 +324,7 @@ def test_chart_comparison_workflow(self, sample_dataframe): bar_column="values", base_color="#FF6B6B", background=True, - thick=True, + thick_bars=True, ), } diff --git a/tests/integration/test_chart_get_method.py b/tests/integration/test_chart_get_method.py index 684d4bc0..23961e54 100644 --- a/tests/integration/test_chart_get_method.py +++ b/tests/integration/test_chart_get_method.py @@ -302,7 +302,7 @@ def mock_get(url): assert chart.reverse_order is True assert chart.background is True assert chart.rules is True - assert chart.thick is False + assert chart.thick_bars is False assert chart.tick_position == "top" # Verify custom range