Skip to content

Commit

Permalink
A wolf in sheep's clothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 24, 2024
1 parent 309a6ef commit 746f6d1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions kyu_8/wolf_in_sheep_clothing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""A wolf in sheep's clothing."""
28 changes: 19 additions & 9 deletions kyu_8/wolf_in_sheep_clothing/test_wolf_in_sheep_clothing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Tests for -> A wolf in sheep's clothing
Tests for -> A wolf in sheep's clothing.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand All @@ -24,16 +25,17 @@
'ARRAYS',
'LOOPS',
'CONTROL FLOW')
@allure.link(url='https://www.codewars.com/kata/5c8bfa44b9d1192e1ebd3d15',
name='Source/Kata')
@allure.link(
url='https://www.codewars.com/kata/5c8bfa44b9d1192e1ebd3d15',
name='Source/Kata')
# pylint: enable=R0801
class WarnTheSheepTestCase(unittest.TestCase):
"""
Testing warn_the_sheep function
"""
"""Testing warn_the_sheep function."""

def test_warn_the_sheep_wolf_at_start(self):
"""
Test the 'warn' func when the wolf in the beginning.
If the wolf is the closest animal to you,
return "Pls go away and stop eating my sheep".
:return:
Expand All @@ -46,7 +48,8 @@ def test_warn_the_sheep_wolf_at_start(self):
'<img src="https://www.codewars.com/users/myFirstCode'
'/badges/large">'
'<h3>Test Description:</h3>'
"<p></p>")
"<p>If the wolf is the closest animal to you, "
"return \"Pls go away and stop eating my sheep\".</p>")
# pylint: enable=R0801
lst: list = ['wolf', 'sheep', 'sheep',
'sheep', 'sheep', 'sheep',
Expand All @@ -60,6 +63,8 @@ def test_warn_the_sheep_wolf_at_start(self):

def test_warn_the_sheep_wolf_in_middle(self):
"""
Test the 'warn' func when the wolf in the middle.
If the wolf is the closest animal to you,
return "Pls go away and stop eating my sheep".
:return:
Expand All @@ -72,7 +77,8 @@ def test_warn_the_sheep_wolf_in_middle(self):
'<img src="https://www.codewars.com/users/myFirstCode'
'/badges/large">'
'<h3>Test Description:</h3>'
"<p></p>")
"<p>If the wolf is the closest animal to you, "
"return \"Pls go away and stop eating my sheep\".</p>")
# pylint: enable=R0801
# 1
lst: list = ['sheep', 'sheep', 'sheep',
Expand Down Expand Up @@ -107,6 +113,8 @@ def test_warn_the_sheep_wolf_in_middle(self):

def test_warn_the_sheep_wolf_at_end(self):
"""
Test the 'warn' func when the wolf in the end.
If the wolf is not the closest animal to you,
return "Oi! Sheep number N! You are about to be eaten by a wolf!"
where N is the sheep's position in the queue.
Expand All @@ -120,7 +128,9 @@ def test_warn_the_sheep_wolf_at_end(self):
'<img src="https://www.codewars.com/users/myFirstCode'
'/badges/large">'
'<h3>Test Description:</h3>'
"<p></p>")
"<p>If the wolf is not the closest animal to you, "
"return \"Oi! Sheep number N! You are about to be eaten by a wolf!\" "
"where N is the sheep's position in the queue.</p>")
# pylint: enable=R0801
lst: list = ['sheep', 'sheep', 'wolf']
expected: str = 'Pls go away and stop eating my sheep'
Expand Down
6 changes: 3 additions & 3 deletions kyu_8/wolf_in_sheep_clothing/wolf_in_sheep_clothing.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
Solution for -> A wolf in sheep's clothing
Solution for -> A wolf in sheep's clothing.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def warn_the_sheep(queue: list) -> str:
"""
Warn the sheep in front of the wolf
that it is about to be eaten.
Warn the sheep in front of the wolf.
If the wolf is the closest animal to you,
return "Pls go away and stop eating my sheep".
Expand Down

0 comments on commit 746f6d1

Please sign in to comment.