From 13bbb82b62935458806c6bbc5f0eab1b71ad6630 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Sat, 14 Dec 2024 11:12:39 -0800 Subject: [PATCH] Update test_list_squared.py --- .../test_list_squared.py | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/kyu_5/integers_recreation_one/test_list_squared.py b/kyu_5/integers_recreation_one/test_list_squared.py index cf750c34044..d3f5d273850 100644 --- a/kyu_5/integers_recreation_one/test_list_squared.py +++ b/kyu_5/integers_recreation_one/test_list_squared.py @@ -9,6 +9,7 @@ import unittest import allure +from parameterized import parameterized from utils.log_func import print_log from kyu_5.integers_recreation_one.solution import list_squared @@ -44,7 +45,20 @@ class ListSquaredTestCase(unittest.TestCase): of the squared divisors. """ - def test_flatten(self): + @parameterized.expand([ + (1, 250, [[1, 1], [42, 2500], [246, 84100]]), + (42, 250, [[42, 2500], [246, 84100]]), + (250, 500, [[287, 84100]]), + (960, 5024, [[1434, 2856100], [1673, 2856100], + [1880, 4884100], [4264, 24304900]]), + (689, 5666, [[728, 722500], [1434, 2856100], + [1673, 2856100], [1880, 4884100], + [4264, 24304900]]), + (257, 4195, [[287, 84100], [728, 722500], + [1434, 2856100], [1673, 2856100], + [1880, 4884100]]) + ]) + def test_flatten(self, m, n, expected): """ Testing list_squared function. @@ -62,26 +76,8 @@ def test_flatten(self): "all integers between m and n whose sum of squared divisors " "is itself a square.

") # pylint: enable-msg=R0801 - test_data: tuple = ( - (1, 250, - [[1, 1], [42, 2500], [246, 84100]]), - (42, 250, - [[42, 2500], [246, 84100]]), - (250, 500, - [[287, 84100]]), - (960, 5024, - [[1434, 2856100], [1673, 2856100], - [1880, 4884100], [4264, 24304900]]), - (689, 5666, - [[728, 722500], [1434, 2856100], - [1673, 2856100], [1880, 4884100], - [4264, 24304900]]), - (257, 4195, [[287, 84100], [728, 722500], - [1434, 2856100], [1673, 2856100], - [1880, 4884100]])) - for m, n, expected in test_data: - with allure.step("Enter test data and verify the output..."): - actual_result = list_squared(m, n) - print_log(m=m, n=n, expected=expected, actual_result=actual_result) - self.assertListEqual(expected, actual_result) + with allure.step("Enter test data and verify the output..."): + actual_result = list_squared(m, n) + print_log(m=m, n=n, expected=expected, actual_result=actual_result) + self.assertListEqual(expected, actual_result)