Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_menu_episode_init():
mymenu = EpisodeMenu(window, source)
assert isinstance(mymenu, EpisodeMenu)
def test_menu_episode_init():
mymenu = EpisodeMenu(window, source)
assert isinstance(mymenu, EpisodeMenu)
def test_menu_episode_item():
mymenu = EpisodeMenu(window, source)
mymenu.update_items(feed)
assert mymenu.item == episode1
mymenu._selected += 1
assert mymenu.item == episode2
def test_menu_episode_update_items(mock_color_pair, mock_A_NORMAL):
mymenu = EpisodeMenu(window, source)
mymenu.update_items(feed)
source.episodes.assert_called_with(feed)
assert len(mymenu._items) == 2
assert len(mymenu) == 2
def test_menu_episode_invert():
mymenu = EpisodeMenu(window, source)
mymenu.invert()
assert mymenu._inverted
mymenu.update_items(feed)
def test_menu_episode_metadata_none():
mymenu = EpisodeMenu(window, source)
assert mymenu.metadata == ""
mymenu.update_items(None)
assert mymenu.metadata == ""
def test_menu_episode_metadata():
mymenu = EpisodeMenu(window, source)
mymenu.update_items(feed)
assert mymenu.metadata == episode1.metadata
def create_menus(self) -> None:
"""Create the menus used in each window, if necessary.
Overrides method from Perspective; see documentation in that class.
"""
assert all(window is not None for window in [
self._feed_window, self._episode_window
])
self._episode_menu = EpisodeMenu(
self._episode_window, self._display.database)
self._feed_menu = FeedMenu(self._feed_window, self._display.database,
child=self._episode_menu, active=True)
def __init__(self, window, source, child=None, active=False) -> None:
assert child is not None and isinstance(child, EpisodeMenu)
self._feeds = []
super().__init__(window, source, child=child, active=active)
def create_menus(self) -> None:
"""Create the menus used in each window.
Overrides method from Perspective; see documentation in that class.
"""
assert all(window is not None for window in [
self._feed_window, self._episode_window
])
self._episode_menu = EpisodeMenu(
self._episode_window, self._display.database)
self._feed_menu = FeedMenu(self._feed_window, self._display.database,
child=self._episode_menu, active=True)