Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #1699

wants to merge 1 commit into from

Conversation

dmytro0908
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Comment on lines +12 to +17
if gender == "male" and spouse:
self.husband = spouse
spouse.wife = self
elif gender == "female" and spouse:
self.wife = spouse
spouse.husband = self

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"

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}"

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.

Comment on lines +88 to +89
f"Person with 'name' {created_person_list[1].name} should not have "
f"attribute wife"

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.

Comment on lines +81 to +82
f"attribute 'wife' with name {created_person_list[0].wife.name} and "
f"Person.wife.husband should links to that Person"

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants