當前位置: 首頁>>代碼示例>>Python>>正文


Python Navigation.quality_select_dialog方法代碼示例

本文整理匯總了Python中navigation.Navigation.quality_select_dialog方法的典型用法代碼示例。如果您正苦於以下問題:Python Navigation.quality_select_dialog方法的具體用法?Python Navigation.quality_select_dialog怎麽用?Python Navigation.quality_select_dialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在navigation.Navigation的用法示例。


在下文中一共展示了Navigation.quality_select_dialog方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: QualitySelectTests

# 需要導入模塊: from navigation import Navigation [as 別名]
# 或者: from navigation.Navigation import quality_select_dialog [as 別名]
class QualitySelectTests(unittest.TestCase):

    def setUp(self):
        self.dialog = Xbmcgui.Dialog()
        self.dialog.select = MagicMock(name='select')
        xbmcgui = Xbmcgui()
        xbmcgui.Dialog = MagicMock(name='Dialog')
        xbmcgui.Dialog.return_value = self.dialog
        self.navigation = Navigation(None, None, xbmcgui, [None, 1])

    def tearDown(self):
        actual = self.navigation.quality_select_dialog(self.input)
        self.assertEqual(actual, self.expected)

        if self.dialog_arg:
            self.dialog.select.assert_called_once_with("Quality Select", self.dialog_arg)
        else:
            self.assertFalse(self.dialog.select.called, "Dialog called!")

    def test_only_one_input(self):
        self.input = [("240p", "url_240")]
        self.expected = "url_240"
        self.dialog_arg = None

    def test_select_first_url(self):
        self.input = [("360p", "url_360"), ('720p', 'url_720')]
        self.dialog_arg = ["360p", "720p"]
        self.dialog.select.return_value = 0
        self.expected = "url_360"

    def test_select_second_url(self):
        self.input = [("360p", "url_360"), ('720p', 'url_720')]
        self.dialog_arg = ["360p", "720p"]
        self.dialog.select.return_value = 1
        self.expected = "url_720"

    def test_unsorted_input(self):
        self.input = [("1080p", "url_1080"), ('720p', 'url_720')]
        self.dialog_arg = ["720p", "1080p"]
        self.dialog.select.return_value = 1
        self.expected = "url_1080"

    def test_select_leading_whitespace_url(self):
        self.input = [("360p", "url_360"), ('720p', ' url_720')]
        self.dialog_arg = ["360p", "720p"]
        self.dialog.select.return_value = 1
        self.expected = "url_720"
開發者ID:daniel-lundin,項目名稱:dreamfilm-xbmc,代碼行數:49,代碼來源:tests.py


注:本文中的navigation.Navigation.quality_select_dialog方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。