Skip to content

Commit

Permalink
Update test_smallest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 15, 2024
1 parent f23da0c commit 32b642d
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions kyu_5/find_the_smallest/test_smallest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand All @@ -48,26 +64,9 @@ def test_smallest(self):
'<h3>Test Description:</h3>'
"<p></p>")
# 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)

0 comments on commit 32b642d

Please sign in to comment.