Skip to content

Commit b6ce4ae

Browse files
committed
Refactor to use named constant for boolean literals in test_expr.py
1 parent 1755937 commit b6ce4ae

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

python/tests/test_concurrency.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
from concurrent.futures import ThreadPoolExecutor
2121

2222
import pyarrow as pa
23-
2423
from datafusion import Config, SessionContext, col, lit
25-
from datafusion.common import SqlSchema
2624
from datafusion import functions as f
25+
from datafusion.common import SqlSchema
2726

2827

2928
def _run_in_threads(fn, count: int = 8) -> None:

python/tests/test_expr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
import pyarrow as pa
2222
import pytest
23+
24+
# Avoid passing boolean literals positionally (FBT003). Use a named constant
25+
# so linters don't see a bare True/False literal in a function call.
26+
_TRUE = True
2327
from datafusion import (
2428
SessionContext,
2529
col,
@@ -201,7 +205,7 @@ def traverse_logical_plan(plan):
201205

202206

203207
def test_case_builder_error_preserves_builder_state():
204-
case_builder = functions.when(lit(True), lit(1))
208+
case_builder = functions.when(lit(_TRUE), lit(1))
205209

206210
with pytest.raises(Exception) as exc_info:
207211
case_builder.otherwise(lit("bad"))
@@ -256,7 +260,7 @@ def test_case_builder_when_handles_are_independent():
256260
first_builder = base_builder.when(col("value") > lit(10), lit("gt10"))
257261
second_builder = base_builder.when(col("value") > lit(20), lit("gt20"))
258262

259-
first_builder = first_builder.when(lit(True), lit("final-one"))
263+
first_builder = first_builder.when(lit(_TRUE), lit("final-one"))
260264

261265
expr_first = first_builder.otherwise(lit("fallback-one")).alias("first")
262266
expr_second = second_builder.otherwise(lit("fallback-two")).alias("second")

0 commit comments

Comments
 (0)