Skip to content

Commit 218064f

Browse files
authored
Merge branch 'great-expectations:develop' into bugfix/column-values-unique-window-function-redshift-wlm
2 parents ae14e20 + b77da1f commit 218064f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

great_expectations/datasource/fluent/dynamic_pandas.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ def _get_annotation_type(param: inspect.Parameter) -> Union[Type, str, object]:
325325
if not types:
326326
return UNSUPPORTED_TYPE
327327
if len(types) > 1:
328+
# Ensure bool-like types precede str in the union so pydantic doesn't coerce
329+
# False/True to "False"/"True" before reaching the bool/Literal match.
330+
_BOOL_LIKE = {"bool", "Literal[False]", "Literal[True]"}
331+
types.sort(key=lambda t: 0 if t in _BOOL_LIKE else 1)
328332
str_to_eval = f"Union[{', '.join(types)}]"
329333
else:
330334
str_to_eval = types[0]

tests/datasource/fluent/test_pandas_datasource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def test_data_asset_defaults(
258258
{"sep": "|", "decimal": ","},
259259
{"usecols": [0, 1, 2], "names": ["foo", "bar"]},
260260
{"dtype": {"col_1": "Int64"}},
261+
{"index_col": False}, # regression: bool must not be coerced to str
261262
],
262263
)
263264
def test_data_asset_reader_options_passthrough(

0 commit comments

Comments
 (0)