Skip to content

Commit

Permalink
==kyu_7.vaporcode
Browse files Browse the repository at this point in the history
kyu_7/easy_line/__init__.py:1:0: R0801: Similar lines in 2 files
==kyu_7.vaporcode.test_vaporcode:[33:40]
==kyu_7.you_are_square.test_you_are_square:[35:42]
        allure.dynamic.severity(allure.severity_level.NORMAL)
        allure.dynamic.description_html('<h3>Codewars badge:</h3>'
                                        '<img src="https://www.codewars.com/users/myFirstCode'
                                        '/badges/large">'
                                        '<h3>Test Description:</h3>'
                                        "<p></p>")
 (duplicate-code)
  • Loading branch information
ikostan committed Sep 27, 2024
1 parent 8bceba4 commit d1c02e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
34 changes: 17 additions & 17 deletions kyu_7/vaporcode/test_vaporcode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
"""
Test for -> V A P O R C O D E
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""

# FUNDAMENTALS

Expand All @@ -16,9 +18,10 @@
@allure.sub_suite("Unit Tests")
@allure.feature("String")
@allure.story('V A P O R C O D E')
@allure.tag()
@allure.link(url='',
name='Source/Kata')
@allure.tag('FUNDAMENTALS')
@allure.link(
url='https://www.codewars.com/kata/5966eeb31b229e44eb00007a/train/python',
name='Source/Kata')
class VaporcodeTestCase(unittest.TestCase):
"""
Testing 'vaporcode' function
Expand All @@ -29,21 +32,21 @@ def test_vaporcode(self):
Testing 'vaporcode' function
:return:
"""

# pylint: disable-msg=R0801
allure.dynamic.title("Testing 'vaporcode' function")
allure.dynamic.severity(allure.severity_level.NORMAL)
allure.dynamic.description_html('<h3>Codewars badge:</h3>'
'<img src="https://www.codewars.com/users/myFirstCode'
'/badges/large">'
'<h3>Test Description:</h3>'
"<p></p>")

allure.dynamic.description_html(
'<h3>Codewars badge:</h3>'
'<img src="https://www.codewars.com/users/myFirstCode'
'/badges/large">'
'<h3>Test Description:</h3>'
"<p></p>")
# pylint: enable-msg=R0801
with allure.step("Enter string with spaces"
" and verify the output"):
s = "Lets go to the movies"
expected = "L E T S G O T O " \
"T H E M O V I E S"

print_log(s=s, expected=expected)
self.assertEqual(vaporcode(s), expected)

Expand All @@ -52,7 +55,6 @@ def test_vaporcode(self):
s = "Why isn't my code working?"
expected = "W H Y I S N ' T M Y " \
"C O D E W O R K I N G ?"

print_log(s=s, expected=expected)
self.assertEqual(vaporcode(s), expected)

Expand All @@ -61,14 +63,12 @@ def test_vaporcode(self):
expected = "; F U V ! Q D V Z X Y - B P " \
"M . ! : F L E Q R L Y , P R G " \
"S : ; R H Z"

print_log(s=s, expected=expected)
self.assertEqual(vaporcode(s), expected)

with allure.step("Enter string with chars"
"only and verify the output"):
s = "blah"
expected = "B L A H"

print_log(s=s, expected=expected)
self.assertEqual(vaporcode(s), expected)
9 changes: 5 additions & 4 deletions kyu_7/vaporcode/vaporcode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
"""
Solution for -> V A P O R C O D E
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def vaporcode(s: str) -> str:
Expand All @@ -10,5 +12,4 @@ def vaporcode(s: str) -> str:
:param s:
:return:
"""

return ' '.join(char.upper() for char in s if char != ' ')

0 comments on commit d1c02e2

Please sign in to comment.