diff --git a/kyu_6/encrypt_this/__init__.py b/kyu_6/encrypt_this/__init__.py index e69de29bb2d..d849d5c028b 100644 --- a/kyu_6/encrypt_this/__init__.py +++ b/kyu_6/encrypt_this/__init__.py @@ -0,0 +1 @@ +"""Encrypt this.""" diff --git a/kyu_6/encrypt_this/solution.py b/kyu_6/encrypt_this/solution.py index ece2d6a668c..c9a96a103fe 100644 --- a/kyu_6/encrypt_this/solution.py +++ b/kyu_6/encrypt_this/solution.py @@ -1,5 +1,6 @@ """ -Solution for -> Encrypt this! +Solution for -> Encrypt this!. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ diff --git a/kyu_6/encrypt_this/test_encrypt_this.py b/kyu_6/encrypt_this/test_encrypt_this.py index 6e59abe6823..867c4923e59 100644 --- a/kyu_6/encrypt_this/test_encrypt_this.py +++ b/kyu_6/encrypt_this/test_encrypt_this.py @@ -1,5 +1,6 @@ """ -Solution for -> Encrypt this! +Solution for -> Encrypt this!. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -10,6 +11,7 @@ import unittest import allure +from parameterized import parameterized from utils.log_func import print_log from kyu_6.encrypt_this.solution import encrypt_this @@ -36,12 +38,27 @@ name='Source/Kata') # pylint: enable-msg=R0801 class EncryptThisTestCase(unittest.TestCase): - """ - Testing encrypt_this function - """ - def test_encrypt_this(self): + """Testing encrypt_this function.""" + + @parameterized.expand([ + ("", ""), + ("Hello", "72olle"), + ("good", "103doo"), + ("hello world", "104olle 119drlo"), + ("A wise old owl lived in an oak", + "65 119esi 111dl 111lw 108dvei 105n 97n 111ka"), + ("The more he saw the less he spoke", + "84eh 109ero 104e 115wa 116eh 108sse 104e 115eokp"), + ("The less he spoke the more he heard", + "84eh 108sse 104e 115eokp 116eh 109ero 104e 104dare"), + ("Why can we not all be like that wise old bird", + "87yh 99na 119e 110to 97ll 98e 108eki 116tah 119esi 111dl 98dri"), + ("Thank you Piotr for all your help", + "84kanh 121uo 80roti 102ro 97ll 121ruo 104ple")]) + def test_encrypt_this(self, text, expected): """ - Testing encrypt_this function + Testing encrypt_this function. + :param self: :return: """ @@ -62,28 +79,7 @@ def test_encrypt_this(self): "Keepin' it simple: There are no special characters in input." "

") # pylint: enable-msg=R0801 - test_data: tuple = ( - ("", - ""), - ("Hello", - "72olle"), - ("good", - "103doo"), - ("hello world", - "104olle 119drlo"), - ("A wise old owl lived in an oak", - "65 119esi 111dl 111lw 108dvei 105n 97n 111ka"), - ("The more he saw the less he spoke", - "84eh 109ero 104e 115wa 116eh 108sse 104e 115eokp"), - ("The less he spoke the more he heard", - "84eh 108sse 104e 115eokp 116eh 109ero 104e 104dare"), - ("Why can we not all be like that wise old bird", - "87yh 99na 119e 110to 97ll 98e 108eki 116tah 119esi 111dl 98dri"), - ("Thank you Piotr for all your help", - "84kanh 121uo 80roti 102ro 97ll 121ruo 104ple")) - - for text, expected in test_data: - result = encrypt_this(text) + result = encrypt_this(text) + with allure.step(f"Enter test string: {text} and verify the output: {expected}."): print_log(text=text, expected=expected, result=result) - with allure.step("Enter test string and verify the output"): - self.assertEqual(expected, result) + self.assertEqual(expected, result)