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


Python Sortings.sort_asc_selection_sort方法代碼示例

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


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

示例1: test_sort_asc_selection_sort__if_non_list_value__exception_thrown

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_non_list_value__exception_thrown(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with int value
        3. Call sort_asc_selection_sort()

        Expected result: Exception thrown
        """
        sortings = Sortings()
        sortings.list = 165

        with self.assertRaises(Exception) as actual:
            sortings.sort_asc_selection_sort()

        self.assertEqual("Can not perform sort asc for object of type not 'list'", actual.exception.message)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:18,代碼來源:SortingStudyTests.py

示例2: test_sort_asc_selection_sort__if_list_of_lists_values__exception_thrown

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_list_of_lists_values__exception_thrown(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with list of lists
        3. Call sort_asc_selection_sort()

        Expected result: Exception thrown
        """
        sortings = Sortings()
        sortings.list = [[2]]

        with self.assertRaises(Exception) as actual:
            sortings.sort_asc_selection_sort()

        self.assertEqual("An input list should contain only numeric values", actual.exception.message)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:18,代碼來源:SortingStudyTests.py

示例3: test_sort_asc_selection_sort__if_empty_list__exception_thrown

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_empty_list__exception_thrown(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list by empty list
        3. Call sort_asc_selection_sort()

        Expected result: Exception thrown
        """
        sortings = Sortings()
        sortings.list = []

        with self.assertRaises(Exception) as actual:
            sortings.sort_asc_selection_sort()

        self.assertEqual("Can not perform sort asc of an empty list", actual.exception.message)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:18,代碼來源:SortingStudyTests.py

示例4: test_sort_asc_selection_sort__if_equal_values__returns_this_list

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_equal_values__returns_this_list(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with equal values
        3. Call sort_asc_selection_sort()

        Expected result: Same list returned
        """
        sortings = Sortings()
        sortings.list = [2, 2, 2, 2, 2, 2]

        actual_result = sortings.sort_asc_selection_sort()

        self.assertEqual([2, 2, 2, 2, 2, 2], actual_result)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:17,代碼來源:SortingStudyTests.py

示例5: test_sort_asc_selection_sort__if_mixed_int_values__returns_list_sorted_asc

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_mixed_int_values__returns_list_sorted_asc(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with mix of negative and non-negative int values
        3. Call sort_asc_selection_sort()

        Expected result: This list sorted asc returned
        """
        sortings = Sortings()
        sortings.list = [-1, -600, 564, -3224, 333, -208, 34, 1, 0]

        actual_result = sortings.sort_asc_selection_sort()

        self.assertEqual([-3224, -600, -208, -1, 0, 1, 34, 333, 564], actual_result)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:17,代碼來源:SortingStudyTests.py

示例6: test_sort_asc_selection_sort__if_negative_values__returns_list_sorted_asc

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_negative_values__returns_list_sorted_asc(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with negative int values
        3. Call sort_asc_selection_sort()

        Expected result: This list sorted asc returned
        """
        sortings = Sortings()
        sortings.list = [-5098, -6000, -564, -324, -13, -28, -45, -1]

        actual_result = sortings.sort_asc_selection_sort()

        self.assertEqual([-6000, -5098, -564, -324, -45, -28, -13, -1], actual_result)
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:17,代碼來源:SortingStudyTests.py

示例7: test_sort_asc_selection_sort__if_mixed_types_values__returns_list_sorted_asc

# 需要導入模塊: from SortingStudy import Sortings [as 別名]
# 或者: from SortingStudy.Sortings import sort_asc_selection_sort [as 別名]
    def test_sort_asc_selection_sort__if_mixed_types_values__returns_list_sorted_asc(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with mix of negative and non-negative int, float, long values
        3. Call sort_asc_selection_sort()

        Expected result: This list sorted asc returned
        """
        sortings = Sortings()
        sortings.list = [-1.0, -600.66, 564, 32.24, 32.3, -208, 10002020202020202049485763542514145637473484389, 1, 0]

        actual_result = sortings.sort_asc_selection_sort()

        self.assertEqual(
            [-600.66, -208, -1.0, 0, 1, 32.24, 32.3, 564, 10002020202020202049485763542514145637473484389L],
            actual_result,
        )
開發者ID:VarvaraKorol,項目名稱:Playground,代碼行數:20,代碼來源:SortingStudyTests.py


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