Skip to content

Commit

Permalink
# Encrypt this
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 17, 2024
1 parent c20735f commit 43d7540
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
1 change: 1 addition & 0 deletions kyu_6/encrypt_this/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Encrypt this."""
3 changes: 2 additions & 1 deletion kyu_6/encrypt_this/solution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Solution for -> Encrypt this!
Solution for -> Encrypt this!.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand Down
56 changes: 26 additions & 30 deletions kyu_6/encrypt_this/test_encrypt_this.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Solution for -> Encrypt this!
Solution for -> Encrypt this!.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand All @@ -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

Expand All @@ -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:
"""
Expand All @@ -62,28 +79,7 @@ def test_encrypt_this(self):
"Keepin' it simple: There are no special characters in input."
"</p>")
# 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)

0 comments on commit 43d7540

Please sign in to comment.