Skip to content

Commit cdca502

Browse files
Editting _assert_right_cell to also return False as requested by SonarQube
1 parent 00b237f commit cdca502

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

utils/dataset_field_util.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,31 +195,32 @@ def _assert_right_cell(
195195
expected_text (str): The expected value to check.
196196
Returns:
197197
bool: True if the expected value is found, False otherwise.
198-
Raises:
199-
AssertionError: If the actual value does not match the expected value.
200198
"""
201199
input_el = right_cell.locator("input")
202200
if input_el.count() > 0:
203201
value = input_el.first.input_value().strip()
204-
assert (
205-
value == expected_text
206-
), f'Expected "{expected_text}" but found "{value}" in input to the right of "{text}".'
207-
logging.info(f'Input to the right of "{text}" contains "{expected_text}"')
208-
return True
202+
if value == expected_text:
203+
logging.info(
204+
f'Input to the right of "{text}" contains "{expected_text}"'
205+
)
206+
return True
207+
return False
208+
209209
select_el = right_cell.locator("select")
210210
if select_el.count() > 0:
211211
selected = select_el.locator("option:checked").inner_text().strip()
212-
assert (
213-
selected == expected_text
214-
), f'Expected "{expected_text}" but found "{selected}" in select to the right of "{text}".'
215-
logging.info(f'Select to the right of "{text}" contains "{expected_text}"')
216-
return True
212+
if selected == expected_text:
213+
logging.info(
214+
f'Select to the right of "{text}" contains "{expected_text}"'
215+
)
216+
return True
217+
return False
218+
217219
generic_text = right_cell.inner_text().strip()
218-
assert (
219-
generic_text == expected_text
220-
), f'Expected "{expected_text}" but found "{generic_text}" in cell to the right of "{text}".'
221-
logging.info(f'Cell to the right of "{text}" contains "{expected_text}"')
222-
return True
220+
if generic_text == expected_text:
221+
logging.info(f'Cell to the right of "{text}" contains "{expected_text}"')
222+
return True
223+
return False
223224

224225
def _check_span_structure(
225226
self, scope: Locator | Page, text: str, expected_text: str

0 commit comments

Comments
 (0)