Skip to content

Commit 3fdb3cd

Browse files
committed
fix: remove redundant identity check in AttributeError test
- Removed 'mock_body is not None and value is None' redundant condition - Simplified test to directly test AttributeError handling scenario - Addresses linter warning about identity check that will always be True - Maintains same test coverage while improving code quality - Follows proper make format && make pr workflow validation
1 parent c16cd7f commit 3fdb3cd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/functional/event_handler/_pydantic/test_uploadfile_coverage.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,11 @@ def get(self, key):
426426
loc = ("body", "test_field")
427427

428428
# Test the specific condition that triggers AttributeError handling
429-
value = None
430-
if mock_body is not None and value is None:
431-
try:
432-
mock_body.get(mock_field.alias)
433-
except AttributeError:
434-
errors.append(get_missing_field_error(loc))
429+
# Simulate the scenario where _get_field_value returns None and we try to double-check
430+
try:
431+
mock_body.get(mock_field.alias)
432+
except AttributeError:
433+
errors.append(get_missing_field_error(loc))
435434

436435
assert len(errors) == 1
437436
assert "test_field" in str(errors[0])

0 commit comments

Comments
 (0)