当前位置: 首页>>代码示例>>Python>>正文


Python Sortings.sort_desc_bubble方法代码示例

本文整理汇总了Python中SortingStudy.Sortings.sort_desc_bubble方法的典型用法代码示例。如果您正苦于以下问题:Python Sortings.sort_desc_bubble方法的具体用法?Python Sortings.sort_desc_bubble怎么用?Python Sortings.sort_desc_bubble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SortingStudy.Sortings的用法示例。


在下文中一共展示了Sortings.sort_desc_bubble方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_sort_desc_bubble_load_test

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble_load_test(self):
        """

        Expected result: The timing should not exceed following numbers:
        1 4.05311584473e-06
        1001 0.4536049366
        2001 1.79013895988
        3001 3.99529099464
        4001 7.08103489876
        5001 11.0427498817
        6001 15.9283699989
        7001 21.6802170277
        8001 28.3089148998
        9001 35.8479449749
        """
        i = 1
        while i < 10000:
            sortings = Sortings(i)

            start = time.time()
            sortings.sort_desc_bubble()
            end = time.time()
            print i, end - start

            i += 1000
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:27,代码来源:SortingsLoadTests.py

示例2: test_sort_desc_bubble__if_list_of_lists_values__exception_thrown

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__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_desc_bubble()

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

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

        self.assertEqual("An input list should contain only numeric values", actual.exception.message)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:18,代码来源:SortingStudyTests.py

示例3: test_sort_desc_bubble__if_non_list_value__exception_thrown

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_non_list_value__exception_thrown(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with int value
        3. Call sort_desc_bubble()

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

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

        self.assertEqual("Can not perform sort desc for object of type not 'list'", actual.exception.message)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:18,代码来源:SortingStudyTests.py

示例4: test_sort_desc_bubble__if_empty_list__exception_thrown

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_empty_list__exception_thrown(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list by empty list
        3. Call sort_desc_bubble()

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

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

        self.assertEqual("Can not perform sort desc of an empty list", actual.exception.message)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:18,代码来源:SortingStudyTests.py

示例5: test_sort_desc_bubble__if_non_negative_values__returns_list_sorted_desc

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_non_negative_values__returns_list_sorted_desc(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with non_negative int values
        3. Call sort_desc_bubble()

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

        actual_result = sortings.sort_desc_bubble()

        self.assertEqual([6000, 5098, 564, 324, 45, 28, 13, 1, 0], actual_result)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:17,代码来源:SortingStudyTests.py

示例6: test_sort_desc_bubble__if_equal_values__returns_this_list

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_equal_values__returns_this_list(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with equal values
        3. Call sort_desc_bubble()

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

        actual_result = sortings.sort_desc_bubble()

        self.assertEqual([2, 2, 2, 2, 2, 2], actual_result)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:17,代码来源:SortingStudyTests.py

示例7: test_sort_desc_bubble__if_mixed_int_values__returns_list_sorted_desc

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

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

        actual_result = sortings.sort_desc_bubble()

        self.assertEqual([564, 333, 34, 1, 0, -1, -208, -600, -3224], actual_result)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:17,代码来源:SortingStudyTests.py

示例8: test_sort_desc_bubble__if_negative_values__returns_list_sorted_desc

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_negative_values__returns_list_sorted_desc(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with negative int values
        3. Call sort_desc_bubble()

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

        actual_result = sortings.sort_desc_bubble()

        self.assertEqual([-1, -13, -28, -45, -324, -564, -5098, -6000], actual_result)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:17,代码来源:SortingStudyTests.py

示例9: test_sort_desc_bubble__if_mixed_types_values__returns_list_sorted_desc

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import sort_desc_bubble [as 别名]
    def test_sort_desc_bubble__if_mixed_types_values__returns_list_sorted_desc(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_desc_bubble()

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

        actual_result = sortings.sort_desc_bubble()

        self.assertEqual(
            [10002020202020202049485763542514145637473484389L, 564, 32.3, 32.24, 1, 0, -1.0, -208, -600.66],
            actual_result,
        )
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:20,代码来源:SortingStudyTests.py


注:本文中的SortingStudy.Sortings.sort_desc_bubble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。