Skip to content

Commit

Permalink
Update test_list_squared.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 14, 2024
1 parent 89bc032 commit 13bbb82
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions kyu_5/integers_recreation_one/test_list_squared.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -62,26 +76,8 @@ def test_flatten(self):
"all integers between m and n whose sum of squared divisors "
"is itself a square.</p>")
# 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)

0 comments on commit 13bbb82

Please sign in to comment.