From 32b642d0ee9dccaaaff2f8775c8876506403334d Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Sun, 15 Dec 2024 02:13:17 -0800 Subject: [PATCH] Update test_smallest.py --- kyu_5/find_the_smallest/test_smallest.py | 43 ++++++++++++------------ 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/kyu_5/find_the_smallest/test_smallest.py b/kyu_5/find_the_smallest/test_smallest.py index 7f93e597a14..034627a461c 100644 --- a/kyu_5/find_the_smallest/test_smallest.py +++ b/kyu_5/find_the_smallest/test_smallest.py @@ -10,6 +10,7 @@ import unittest import pytest import allure +from parameterized import parameterized from utils.log_func import print_log from kyu_5.find_the_smallest.solution import smallest @@ -30,7 +31,22 @@ class FindSmallestTestCase(unittest.TestCase): """Testing smallest function.""" - def test_smallest(self): + @parameterized.expand([ + (261235, [126235, 2, 0]), + (209917, [29917, 0, 1]), + (285365, [238565, 3, 1]), + (269045, [26945, 3, 0]), + (296837, [239687, 4, 1]), + (935855753, [358557539, 0, 8]), + (346674147588841927, [134667414758884927, 14, 0]), + (352343279580894007, [35234327958089407, 15, 0]), + (633814808310045545, [63381480831045545, 11, 0]), + (71269954474326234, [12679954474326234, 0, 3]), + (400360725952391834, [3460725952391834, 0, 3]), + (914459749498173781, [144597494981737819, 0, 17]), + (113343536213382181, [111334353621338218, 17, 0]), + (614132919143656569, [141326919143656569, 0, 5])]) + def test_smallest(self, n, expected): """ Testing smallest function with various test data. @@ -48,26 +64,9 @@ def test_smallest(self): '

Test Description:

' "

") # pylint: enable-msg=R0801 - test_data: tuple = ((261235, [126235, 2, 0]), - (209917, [29917, 0, 1]), - (285365, [238565, 3, 1]), - (269045, [26945, 3, 0]), - (296837, [239687, 4, 1]), - (346674147588841927, [134667414758884927, 14, 0]), - (352343279580894007, [35234327958089407, 15, 0]), - (633814808310045545, [63381480831045545, 11, 0]), - (935855753, [358557539, 0, 8]), - (71269954474326234, [12679954474326234, 0, 3]), - (400360725952391834, [3460725952391834, 0, 3]), - (914459749498173781, [144597494981737819, 0, 17]), - (113343536213382181, [111334353621338218, 17, 0]), - (614132919143656569, [141326919143656569, 0, 5])) - for n, expected in test_data: + with allure.step(f"Enter test data: {n} " + f"and verify the output vs expected: {expected}."): result = smallest(n) - with allure.step("Enter test data and verify the output vs expected"): - print_log(n=n, - expected=expected, - result=result) - - self.assertListEqual(expected, result) + print_log(n=n, expected=expected, result=result) + self.assertListEqual(expected, result)