-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1699
base: master
Are you sure you want to change the base?
Solution #1699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the Person
class and the create_person_list
function! 🎉 Your code meets the task requirements and constraints effectively. While there are some assumptions in the test cases regarding the presence of 'wife' and 'husband' attributes, these do not critically impact the functionality. As you continue to refine your code, consider making the gender determination logic more robust to handle potential changes in data structure. Keep up the good work! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
if gender == "male" and spouse: | ||
self.husband = spouse | ||
spouse.wife = self | ||
elif gender == "female" and spouse: | ||
self.wife = spouse | ||
spouse.husband = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here assumes that the gender is determined by the presence of 'husband' or 'wife' in the data. This might not be accurate if the data structure changes or if the gender is explicitly provided. Consider revising the logic to handle gender more explicitly or based on additional data.
person_data.get("wife") or person_data.get("husband") | ||
) | ||
|
||
gender = "male" if "husband" in person_data else "female" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gender determination logic assumes that the presence of 'husband' indicates a male and 'wife' indicates a female. This might not be accurate if the data structure changes or if the gender is explicitly provided. Consider revising the logic to handle gender more explicitly or based on additional data.
def test_create_person_list_has_wife(people_data, created_person_list): | ||
assert hasattr(created_person_list[0], "wife"), ( | ||
f"Person with 'name' {created_person_list[0].name} should have " | ||
f"attribute 'wife' with name {people_data[0].wife.name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test assumes that the 'wife' attribute is always present and accessible. This might not be the case if the logic in main.py
changes or if the data structure is different. Consider adding checks to ensure the attribute exists before accessing it.
f"Person with 'name' {created_person_list[1].name} should not have " | ||
f"attribute wife" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test assumes that the 'wife' attribute should not exist for certain instances. Ensure that the logic in main.py
aligns with this assumption, as changes in the main logic might affect this test.
f"attribute 'wife' with name {created_person_list[0].wife.name} and " | ||
f"Person.wife.husband should links to that Person" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test assumes that the 'wife' and 'husband' attributes are always set correctly. This might not hold true if the logic in main.py
changes. Consider adding checks to ensure these attributes are set as expected.
No description provided.