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


Python Sortings.list方法代码示例

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


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

示例1: test_calculate_total_product__if_one_positive_value__returns_this_value

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

        Expected result: This value returned
        """
        sortings = Sortings()
        sortings.list = [11]
        actual_result = sortings.calculate_total_product()
        self.assertEqual(11, actual_result)
开发者ID:VarvaraKorol,项目名称:Playground,代码行数:15,代码来源:SortingStudyTests.py

示例2: test_sort_desc_bubble__if_non_negative_values__returns_list_sorted_desc

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

示例3: test__find_minimum__if_float_values__returns_minimum

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

        Expected result: The minimal value returned
        """
        sortings = Sortings()
        sortings.list = [0.333, 0, 1 / 3, 1.0 / 3.0]

        actual_result = sortings.find_minimum()

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

示例4: test_calculate_total__total_is_calculated

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

        Expected result: Total of int values returned
        """
        sortings = Sortings()
        sortings.list = [20202, 1, 2, 3]

        actual_result = sortings.calculate_total()

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

示例5: test__find_minimum__if_negative_values__returns_minimum

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

        Expected result: The minimal negative value returned
        """
        sortings = Sortings()
        sortings.list = [-2, 2, -1, 0]

        actual_result = sortings.find_minimum()

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

示例6: test_sort_asc_bubble__if_mixed_int_values__returns_list_sorted_asc

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

        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_bubble()

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

示例7: test_calculate_total_product__if_3_negative_values__returns_negative_product

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

        Expected result: Correct total returned
        """
        sortings = Sortings()
        sortings.list = [-2, -10, -3]

        actual_result = sortings.calculate_total_product()

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

示例8: test__find_maximum__if_one_value__returns_this_value

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

        Expected result: This value is returned
        """
        sortings = Sortings()
        sortings.list = [0]

        actual_result = sortings.find_maximum()

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

示例9: test_sort_asc_bubble__if_negative_values__returns_list_sorted_asc

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

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

        actual_result = sortings.sort_asc_bubble()

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

示例10: test__find_maximum__if_all_values_are_identical__returns_one_value

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

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

        actual_result = sortings.find_maximum()

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

示例11: test_calculate_total_product__if_0_among_values__returns_0

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

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

        actual_result = sortings.calculate_total_product()

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

示例12: test_sort_asc_bubble__if_equal_values__returns_this_list

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

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

        actual_result = sortings.sort_asc_bubble()

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

示例13: test_find_minimum__two_times__returns_minimal

# 需要导入模块: from SortingStudy import Sortings [as 别名]
# 或者: from SortingStudy.Sortings import list [as 别名]
    def test_find_minimum__two_times__returns_minimal(self):
        """
        Scenario:
        1. Create object of Sortings class
        2. Initialize list with positive integers
        3. Call find_minimum() method
        4. Initialize list with other positive integers
        5. Call find_minimum() method

        Expected result: A correct minimum value returned both times.
        """

        sortings = Sortings()
        sortings.list = [5, 1, 2, 3]

        actual_result = sortings.find_minimum()

        self.assertEqual(1, actual_result)

        sortings.list = [3456, 123, 12, 35]

        actual_result = sortings.find_minimum()

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

示例14: test_calculate_total_product__returns_total_product

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

        Expected result: Correct value of total product returned
        """
        sortings = Sortings()
        sortings.list = [444, 1, 2, 3]

        actual_result = sortings.calculate_total_product()

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

示例15: test__calculate_total__if_float_values__returns_total

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

        Expected result: Correct total returned
        """
        sortings = Sortings()
        sortings.list = [0.333, 0, 1 / 3, 1.0 / 3.0]

        actual_result = sortings.calculate_total()

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


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