test: Remove unnecessary 'or []' fallback in assertions #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Improve test code quality by removing unnecessary defensive checks and adding explicit validations discovered during #77 investigation.
Key Changes
or []fallback infixed_ipsassertionsres.fixed_ips or []→res.fixed_ips(fixed_ips is never None in test contexts)test_add_port_fixed_ipandtest_remove_port_fixed_ipassert bulk[0].id == f1.idintest_update_reassign_bulk_and_auto_assign_floating_ipRelated Issues
mock_mcp.tool.call_countissues, but none were found)Additional context
While investigating #77 for potential
call_counttest issues, no problems were found with that specific case. However, these code quality improvements were identified and addressed:or []pattern was redundant sincefixed_ipsis always a list in these test scenarioslen(bulk) == 1) without validating the actual returned object's ID, so added explicit value validationOverview
#77 조사 중 발견된 불필요한 방어 코드를 제거하고 명시적인 검증을 추가하여 테스트 코드 품질을 개선합니다.
Key Changes
fixed_ipsassertion에서 불필요한or []폴백 제거res.fixed_ips or []→res.fixed_ips(테스트 컨텍스트에서 fixed_ips는 절대 None이 아님)test_add_port_fixed_ip와test_remove_port_fixed_ip에 적용test_update_reassign_bulk_and_auto_assign_floating_ip에assert bulk[0].id == f1.id추가Related Issues
mock_mcp.tool.call_count문제를 조사했으나 발견되지 않음)Additional context
#77의
call_count테스트 문제를 조사하는 과정에서 해당 케이스의 문제는 발견되지 않았으나, 다음과 같은 코드 품질 개선 사항을 발견하여 수정했습니다:or []패턴은 테스트 시나리오에서fixed_ips가 항상 리스트이므로 불필요함len(bulk) == 1)만 하고 있어, 반환된 객체의 실제 값(ID)에 대한 검증을 추가함