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

Fix a bug in TraitList.remove #981

Merged
merged 2 commits into from
Apr 3, 2020
Merged

Fix a bug in TraitList.remove #981

merged 2 commits into from
Apr 3, 2020

Conversation

midhun-pm
Copy link
Contributor

@midhun-pm midhun-pm commented Apr 3, 2020

Checklist

  • Tests
    - [ ] Update API reference (docs/source/traits_api_reference)
    - [ ] Update User manual (docs/source/traits_user_manual)
    - [ ] Update type annotation hints in traits-stubs

Fixes #980

tl.remove(2.0)
self.assertEqual(self.index, 1)
self.assertEqual(self.removed, [2])
self.assertIs(self.removed[0], 2)
Copy link
Member

Choose a reason for hiding this comment

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

Rather than an assertIs check (it's not guaranteed by the language that 2 is 2 will give True), I suggest doing a type check: self.assertIsInstance(self.removed[0], int).

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

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

LGTM; one nitpick about the test.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@mdickinson mdickinson merged commit e3485a6 into master Apr 3, 2020
@mdickinson mdickinson deleted the bugfix/TraitList.remove branch April 3, 2020 18:53
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.

TraitList.remove notification gives incorrect 'removed'
2 participants