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

Update super usage in potentially buggy cases #790

Merged
merged 4 commits into from
Apr 21, 2021

Conversation

rahulporuri
Copy link
Contributor

@rahulporuri rahulporuri commented Apr 21, 2021

See related #789

This PR updates a few calls to super that were potentially buggy. In these two cases for example, we were calling super(A, self) from class B where B inherits from A. We first update the super calls to use the correct class argument - and then update the super call to remove the arguments altogether.

we were using `super(Container, self)` from inside `Canvas`, which seems like
an unintentional bug
enable/canvas.py Outdated Show resolved Hide resolved
enable/text_grid.py Outdated Show resolved Hide resolved
@rahulporuri rahulporuri changed the title [WIP] Update super usage in potentially buggy cases Apr 21, 2021
Copy link
Contributor

@aaronayres35 aaronayres35 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -53,7 +53,7 @@ class GuiTestAssistant(object):
class HoverToolTestCase(EnableTestAssistant, GuiTestAssistant,
unittest.TestCase):
def setUp(self):
super(HoverToolTestCase, self).setUp()
GuiTestAssistant.setUp(self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question I had on the other PR, why exactly do we purposefully avoid super for setUp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

answered elsewhere - part convention, part best practice - especially because we have cases where we need to call setUp on more than one base class.

@rahulporuri rahulporuri merged commit 381036e into master Apr 21, 2021
@rahulporuri rahulporuri deleted the rahulporuri-patch-2 branch April 21, 2021 13:42
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