Skip to content

Commit 2bc8ea1

Browse files
committed
style: fix lint issues in blocks.py and test_blocks_unpivot.py
1 parent 14a4272 commit 2bc8ea1

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

bigframes/core/blocks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __init__(
160160
)
161161
self._expr = self._normalize_expression(expr, self._index_columns)
162162

163-
# FIX: Calculate value_columns after normalizing expression
163+
# Calculate value_columns after normalizing expression
164164
actual_value_columns = [
165165
column
166166
for column in self._expr.column_ids
@@ -174,7 +174,7 @@ def __init__(
174174
else pd.Index(column_labels)
175175
)
176176

177-
# FIX: Adjust column_labels if needed to match actual_value_columns
177+
# Adjust column_labels if needed to match actual_value_columns
178178
if len(actual_value_columns) != len(self._column_labels):
179179
# If we have more value columns than labels, extend with None
180180
if len(actual_value_columns) > len(self._column_labels):
@@ -191,7 +191,8 @@ def __init__(
191191
# Re-validate after adjustment
192192
if len(actual_value_columns) != len(self._column_labels):
193193
raise ValueError(
194-
f"'value_columns' (size {len(actual_value_columns)}) and 'column_labels' (size {len(self._column_labels)}) must have equal length"
194+
f"'value_columns' (size {len(actual_value_columns)}) and "
195+
f"'column_labels' (size {len(self._column_labels)}) must have equal length"
195196
)
196197

197198
# Update value_columns property to use actual_value_columns

tests/unit/core/test_blocks_unpivot.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from unittest import mock
1616

1717
import pandas as pd
18+
import pyarrow as pa
1819
import pytest
1920

2021
from bigframes.core import blocks
@@ -28,8 +29,7 @@ def mock_session():
2829

2930

3031
def test_pd_index_to_array_value_with_empty_index_creates_no_columns(mock_session):
31-
"""
32-
Tests that `_pd_index_to_array_value` with an empty pandas Index creates
32+
"""Tests that `_pd_index_to_array_value` with an empty pandas Index creates
3333
an ArrayValue with the expected number of columns (index level + offset).
3434
"""
3535
empty_index = pd.Index([], name="test")
@@ -41,8 +41,7 @@ def test_pd_index_to_array_value_with_empty_index_creates_no_columns(mock_sessio
4141

4242

4343
def test_pd_index_to_array_value_with_empty_multiindex_creates_no_columns(mock_session):
44-
"""
45-
Tests that `_pd_index_to_array_value` with an empty pandas MultiIndex creates
44+
"""Tests that `_pd_index_to_array_value` with an empty pandas MultiIndex creates
4645
an ArrayValue with the expected number of columns (index levels + offset).
4746
"""
4847
empty_index = pd.MultiIndex.from_arrays([[], []], names=["a", "b"])
@@ -54,11 +53,7 @@ def test_pd_index_to_array_value_with_empty_multiindex_creates_no_columns(mock_s
5453

5554

5655
def test_unpivot_with_empty_row_labels(mock_session):
57-
"""
58-
Tests that `unpivot` handles an empty `row_labels` index correctly by producing 0 rows.
59-
"""
60-
import pyarrow as pa
61-
56+
"""Tests that `unpivot` handles an empty `row_labels` index correctly by producing 0 rows."""
6257
# Create a dummy ArrayValue
6358
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
6459
pa_table = pa.Table.from_pandas(df)

0 commit comments

Comments
 (0)