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 a GUI test for Enum.create_editor #988

Merged
merged 5 commits into from
Apr 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some cleanup
midhun-pm committed Apr 14, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 88c119d3c779f9e4e84be3e36d91ea5fb6df040e
11 changes: 6 additions & 5 deletions traits/tests/test_enum.py
Original file line number Diff line number Diff line change
@@ -311,18 +311,19 @@ class TestGui(GuiTestAssistant, unittest.TestCase):

def test_create_editor(self):
obj = EnumCollectionGUIExample()
traits = obj.class_trait_names()
traits.remove("trait_added")
traits.remove("trait_modified")
user_editable_traits = obj.class_editable_traits()

# Create a UI window
ui = obj.edit_traits()
for t in traits:

for t in user_editable_traits:

with self.subTest(t=t):
editor = getattr(ui.info, t)
values = obj.trait(t).trait_type.values

# Try setting all valid values for the Enum trait
for value in obj.trait(t).trait_type.values:
for value in values:
with self.assertTraitChangesInEventLoop(
obj, t, lambda instance: getattr(
instance, t) == value, 0, 3):