-
Notifications
You must be signed in to change notification settings - Fork 3
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
Overload [] operators for getting and setting selected inputs #68
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.
Hi! I appreciate your PR, as I'm fairly new with OO Python and I did not think about getitem and setItem. However, I did the tests that way as they were easier for me to read and execute, tho I assume it depends on each own personal liking. I'll wait for your opinion on that for the merge of the branch. Thanks for your contribution!
I separated the tests into different assert statements because when the interpreter catches the error it tells you exactly which case (or line) is causing the problem. When you have a project that has hundreds of tests this might save you some time, I think. |
okay it seems reasonable when doing a bunch of tests of some module. I will be doing that for sure for some modules i have in mind. I'm accepting your PR, thanks for all! |
Hello LovetheFrogs, you have a cool project so I thought I could add some extra features like overloading the [] operator so there's no need to type the whole .get_input() / .set_input() methods. I have also added a section to the remove_input() method so it is possible to delete an input given an index number.
I have also changed the testing files for logic gates to be different asserts statements because I thought it would be easier to go to the line where the error is directly. Instead of finding the string that belongs to an if-statement now it's possible to go directly to the line causing the problem.
If you like/agree with these changes feel free to accept the pull request.