Skip to content

Commit a1f012d

Browse files
fix test and docstring
1 parent 979aa49 commit a1f012d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/feelpp/benchmarking/report/transformationFactory.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ def calculate(self,df):
1616
@staticmethod
1717
def chooseColumn(value,df):
1818
""" Chooses a column from a list of possible columns splitted by '|' from a dataframe, returns the first occurence in the dataframe.
19-
If no column is found, returns None
20-
If the value is null (0, False, None, ...), returns None
19+
IF the value is null (0, False, None, ...) or not found, returns None
2120
Args:
2221
value (str): The string containing the possible columns, splitted by '|'. e.g. "column1|column2|column3"
2322
df (pd.DataFrame): The dataframe where the columns are searched
2423
Returns:
2524
str: The first column found in the dataframe, or None
2625
"""
2726
if not value:
28-
return value
27+
return None
2928

3029
possible_columns = value.split("|")
3130
for column in possible_columns:

tests/report/test_transformationFactory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_speedupStrategy(self):
112112
("non_existent|param2","param2"),
113113
("non_existent|param2|param3","param2"),
114114
("non_existent",None),
115-
(0,0), (None,None), (False,None),
115+
(0,None), (None,None), (False,None),
116116
])
117117
def test_chooseColumn(self,param_names,expected):
118118
df = pd.DataFrame(columns=["param1","param2","param3","param4"])

0 commit comments

Comments
 (0)