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

Add test for regular Python properties in HasTraits classes #1248

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

mdickinson
Copy link
Member

@mdickinson mdickinson commented Jul 20, 2020

This PR adds tests that check that normal Python properties in a HasTraits subclass behave in the expected manner.

These tests should prevent deter any unthinking attempt to remove these lines in HasTraits, which are there to support exactly this use-case:

traits/traits/has_traits.py

Lines 479 to 480 in e16be10

elif isinstance(value, property):
class_traits[name] = generic_trait

I've verified that the new tests fail if the two lines above are removed.

Closes #947.

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

Changes LGTM.

@mdickinson mdickinson merged commit 27090e4 into master Jul 21, 2020
@mdickinson mdickinson deleted the test/regular-python-properties branch July 21, 2020 07:09
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.

Why do normal Python properties become class traits in a HasTraits subclass?
2 participants