Skip to content

Commit acd0fc2

Browse files
committed
change _prep_column_text to only throw if it gets None
1 parent e86c21f commit acd0fc2

File tree

2 files changed

+14
-645
lines changed

2 files changed

+14
-645
lines changed

pointblank/validate.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
from collections.abc import Collection
100100
from typing import Any
101101

102-
from pointblank._typing import AbsoluteBounds, Tolerance
102+
from pointblank._typing import AbsoluteBounds, Tolerance, _CompliantValue, _CompliantValues
103103

104104
__all__ = [
105105
"Validate",
@@ -13149,7 +13149,7 @@ def _process_action_str(
1314913149

1315013150

1315113151
def _create_autobrief_or_failure_text(
13152-
assertion_type: str, lang: str, column: str | None, values: str | None, for_failure: bool
13152+
assertion_type: str, lang: str, column: str, values: str | None, for_failure: bool
1315313153
) -> str:
1315413154
if assertion_type in [
1315513155
"col_vals_gt",
@@ -13289,7 +13289,7 @@ def _expect_failure_type(for_failure: bool) -> str:
1328913289
def _create_text_comparison(
1329013290
assertion_type: str,
1329113291
lang: str,
13292-
column: str | list[str] | None,
13292+
column: str | list[str],
1329313293
values: str | None,
1329413294
for_failure: bool = False,
1329513295
) -> str:
@@ -13315,7 +13315,7 @@ def _create_text_comparison(
1331513315

1331613316
def _create_text_between(
1331713317
lang: str,
13318-
column: str | None,
13318+
column: str,
1331913319
value_1: str,
1332013320
value_2: str,
1332113321
not_: bool = False,
@@ -13345,7 +13345,7 @@ def _create_text_between(
1334513345

1334613346

1334713347
def _create_text_set(
13348-
lang: str, column: str | None, values: list[any], not_: bool = False, for_failure: bool = False
13348+
lang: str, column: str, values: list[any], not_: bool = False, for_failure: bool = False
1334913349
) -> str:
1335013350
type_ = _expect_failure_type(for_failure=for_failure)
1335113351

@@ -13367,9 +13367,7 @@ def _create_text_set(
1336713367
return text
1336813368

1336913369

13370-
def _create_text_null(
13371-
lang: str, column: str | None, not_: bool = False, for_failure: bool = False
13372-
) -> str:
13370+
def _create_text_null(lang: str, column: str, not_: bool = False, for_failure: bool = False) -> str:
1337313371
type_ = _expect_failure_type(for_failure=for_failure)
1337413372

1337513373
column_text = _prep_column_text(column=column)
@@ -13386,9 +13384,7 @@ def _create_text_null(
1338613384
return text
1338713385

1338813386

13389-
def _create_text_regex(
13390-
lang: str, column: str | None, pattern: str, for_failure: bool = False
13391-
) -> str:
13387+
def _create_text_regex(lang: str, column: str, pattern: str, for_failure: bool = False) -> str:
1339213388
type_ = _expect_failure_type(for_failure=for_failure)
1339313389

1339413390
column_text = _prep_column_text(column=column)
@@ -13455,15 +13451,15 @@ def _create_text_rows_complete(
1345513451
return text
1345613452

1345713453

13458-
def _create_text_row_count_match(lang: str, value: int, for_failure: bool = False) -> str:
13454+
def _create_text_row_count_match(lang: str, value: dict, for_failure: bool = False) -> str:
1345913455
type_ = _expect_failure_type(for_failure=for_failure)
1346013456

1346113457
values_text = _prep_values_text(value["count"], lang=lang)
1346213458

1346313459
return EXPECT_FAIL_TEXT[f"row_count_match_n_{type_}_text"][lang].format(values_text=values_text)
1346413460

1346513461

13466-
def _create_text_col_count_match(lang: str, value: int, for_failure: bool = False) -> str:
13462+
def _create_text_col_count_match(lang: str, value: dict, for_failure: bool = False) -> str:
1346713463
type_ = _expect_failure_type(for_failure=for_failure)
1346813464

1346913465
values_text = _prep_values_text(value["count"], lang=lang)
@@ -13486,19 +13482,13 @@ def _create_text_specially(lang: str, for_failure: bool = False) -> str:
1348613482
def _prep_column_text(column: str | list[str]) -> str:
1348713483
if isinstance(column, list):
1348813484
return "`" + str(column[0]) + "`"
13489-
elif isinstance(column, str):
13485+
if isinstance(column, str):
1349013486
return "`" + column + "`"
13491-
else:
13492-
return ""
13487+
raise AssertionError
1349313488

1349413489

1349513490
def _prep_values_text(
13496-
values: str
13497-
| int
13498-
| float
13499-
| datetime.datetime
13500-
| datetime.date
13501-
| list[str | int | float | datetime.datetime | datetime.date],
13491+
values: _CompliantValue | _CompliantValues,
1350213492
lang: str,
1350313493
limit: int = 3,
1350413494
) -> str:

0 commit comments

Comments
 (0)