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

User empty object print ValueError #122

Merged
merged 5 commits into from
May 7, 2024

Conversation

Bachibouzouk
Copy link
Collaborator

@Bachibouzouk Bachibouzouk commented Apr 2, 2024

issue:
When a user object is empty cannot be printed due as the repr method uses the save() method to print the properties of the users, which raise Exception in case no appliances are added to the user.

solution:
in case save() methods returns an exception, the function prints the user_name, and user_num with a message to mention no appliances are assigned to the user object yet.

additional:

  • found a bug in __eq__ method of Appliance class and fixed it
  • add the possibility for a user to pass directly Appliance instances to the add_appliance method of the User class
  • add two new test files

@Bachibouzouk
Copy link
Collaborator Author

@mohammadamint - I added a new method and fixed a bug in Appliance comparison I found while playing around with Appliances to test your fix

Copy link
Contributor

@FLomb FLomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me

Mohammad Amin Tahavori and others added 4 commits May 7, 2024 18:10
issue:
When a user object is empty cannot be printed due as the __repr__ method
uses the save() method to print the properties of the users, which raise
Exception in case no appliances are added to the user.

solution:
in case save() methods returns an exception, the function prints the
user_name, and user_num with a message to mention no appliances are
assigned to the user object yet.
The comparisons were not saved so the return value was always "True"
@Bachibouzouk Bachibouzouk merged commit 0e05c81 into joss-paper May 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants