diff --git a/kyu_6/sum_of_digits_digital_root/__init__.py b/kyu_6/sum_of_digits_digital_root/__init__.py index e69de29bb2d..f8852e83334 100644 --- a/kyu_6/sum_of_digits_digital_root/__init__.py +++ b/kyu_6/sum_of_digits_digital_root/__init__.py @@ -0,0 +1 @@ +"""Sum of Digits / Digital Root.""" diff --git a/kyu_6/sum_of_digits_digital_root/digital_root.py b/kyu_6/sum_of_digits_digital_root/digital_root.py index f7f06e1c09e..340dddb02cc 100644 --- a/kyu_6/sum_of_digits_digital_root/digital_root.py +++ b/kyu_6/sum_of_digits_digital_root/digital_root.py @@ -1,5 +1,6 @@ """ -Solution for -> Sum of Digits / Digital Root +Solution for -> Sum of Digits / Digital Root. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -14,7 +15,6 @@ def digital_root(n: int) -> int: If that value has more than one digit, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers. - :param n: :return: """ diff --git a/kyu_6/sum_of_digits_digital_root/test_digital_root.py b/kyu_6/sum_of_digits_digital_root/test_digital_root.py index 2c99719aec7..104c2b268aa 100644 --- a/kyu_6/sum_of_digits_digital_root/test_digital_root.py +++ b/kyu_6/sum_of_digits_digital_root/test_digital_root.py @@ -1,5 +1,6 @@ """ -Test for -> Sum of Digits / Digital Root +Test for -> Sum of Digits / Digital Root. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -8,6 +9,7 @@ import unittest import allure +from parameterized import parameterized from utils.log_func import print_log from kyu_6.sum_of_digits_digital_root.digital_root \ import digital_root @@ -27,10 +29,15 @@ url='https://www.codewars.com/kata/541c8630095125aba6000c00', name='Source/Kata') class DigitalRootTestCase(unittest.TestCase): - """ - Testing digital_root function - """ - def test_digital_root(self): + """Testing digital_root function.""" + + @parameterized.expand([ + (16, 7), + (456, 6), + (942, 6), + (132189, 6), + (493193, 2)]) + def test_digital_root(self, n, expected): """ In this kata, you must create a digital root function. @@ -51,14 +58,7 @@ def test_digital_root(self): '