def test_adding_data(self): parent = Parent() items = PopupMenuItems(parent, ['Do Something']) assert_equal(len(items._items), 1) items.add_menu_item(PopupMenuItem('Do', parent=parent)) assert_equal(len(items._items), 2) _test = lambda: None items.add_menu_item(PopupMenuItem('Do', callable=_test)) assert_equal(len(items._items), 3) assert_equal(items._items[-1].callable, _test)
def test_adding_separator(self): items = PopupMenuItems() items.add_separator() assert_equal(len(items._items), 1)
def test_initing_with_data(self): parent = Parent() items = PopupMenuItems(parent, ['Do Something', 'Do']) assert_equal(len(items._items), 2)
def test_initing_without_data(self): items = PopupMenuItems() assert_equal(len(items._items), 0)