Skip to content

Commit b9763ba

Browse files
authored
ajout de cas d'interpretation de boolean (#1977)
1 parent 5a87ab0 commit b9763ba

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dags/sources/tasks/transform/transform_column.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def cast_eo_boolean_or_string_to_boolean(value: str | bool, _) -> bool | None:
1818
if isinstance(value, bool):
1919
return value
2020
if isinstance(value, str):
21-
if value.lower().strip() == "oui":
21+
if value.lower().strip() in ["oui", "yes", "true"]:
2222
return True
23-
if value.lower().strip() == "non":
23+
if value.lower().strip() in ["non", "no", "false"]:
2424
return False
2525
return None
2626

dags/tests/sources/tasks/transform/test_transform_column.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class TestCastEOBooleanOrStringToBoolean:
3535
("non", False),
3636
("NON", False),
3737
(" NON ", False),
38+
("no", False),
39+
("yes", True),
40+
("False", False),
41+
("True", True),
3842
("", None),
3943
(" ", None),
4044
("fake", None),

0 commit comments

Comments
 (0)