<s> from traits . api import Bool , HasTraits , Instance , Int , List <EOL> from traitsui . api import Item , TreeEditor , TreeNode , View <EOL> from traitsui . tests . _tools import * <EOL> class Bogus ( HasTraits ) : <EOL> """<STR_LIT>""" <EOL> bogus_list = List <EOL> class BogusTreeView ( HasTraits ) : <EOL> """<STR_LIT>""" <EOL> bogus = Instance ( Bogus ) <EOL> hide_root = Bool <EOL> def default_traits_view ( self ) : <EOL> nodes = [ <EOL> TreeNode ( node_for = [ Bogus ] , children = '<STR_LIT>' , label = '<STR_LIT>' ) , <EOL> ] <EOL> tree_editor = TreeEditor ( <EOL> nodes = nodes , hide_root = self . hide_root , editable = False <EOL> ) <EOL> traits_view = View ( <EOL> Item ( name = '<STR_LIT>' , id = '<STR_LIT>' , editor = tree_editor ) , <EOL> buttons = [ '<STR_LIT:OK>' ] , <EOL> ) <EOL> return traits_view <EOL> def _test_tree_editor_releases_listeners ( hide_root ) : <EOL> """<STR_LIT>""" <EOL> with store_exceptions_on_all_threads ( ) : <EOL> bogus = Bogus ( bogus_list = [ Bogus ( ) ] ) <EOL> tree_editor_view = BogusTreeView ( bogus = bogus , hide_root = hide_root ) <EOL> ui = tree_editor_view . edit_traits ( ) <EOL> notifiers_list = bogus . trait ( '<STR_LIT>' ) . _notifiers ( False ) <EOL> nose . tools . assert_equal ( <NUM_LIT:1> , len ( notifiers_list ) ) <EOL> press_ok_button ( ui ) <EOL> notifiers_list = bogus . trait ( '<STR_LIT>' ) . _notifiers ( False ) <EOL> nose . tools . assert_equal ( <NUM_LIT:0> , len ( notifiers_list ) ) <EOL> @ skip_if_null <EOL> def test_tree_editor_listeners_with_shown_root ( ) : <EOL> _test_tree_editor_releases_listeners ( hide_root = False ) <EOL> @ skip_if_null <EOL> def test_tree_editor_listeners_with_hidden_root ( ) : <EOL> _test_tree_editor_releases_listeners ( hide_root = True ) </s>
