Skip to content

Commit

Permalink
# The museum of incredible dull things
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 20, 2024
1 parent 81b244b commit 3b64528
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion kyu_7/pull_your_words_together_man/sentencify.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def sentencify(words: list) -> str:
2. Add a period (.) to the end of the sentence.
3. Join the words into a complete string, with spaces.
4. Do no other manipulation on the words.
:param words: list
:return: str
"""
Expand Down
1 change: 1 addition & 0 deletions kyu_7/remove_the_minimum/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""The museum of incredible dull things."""
7 changes: 4 additions & 3 deletions kyu_7/remove_the_minimum/remove_the_minimum.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
"""
Solution for -> The museum of incredible dull things
Solution for -> The museum of incredible dull things.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def remove_smallest(numbers: list) -> list:
"""
Remove the smallest function.
Given an array of integers, remove the smallest value.
Do not mutate the original array/list. If there are multiple
elements with the same value, remove the one with a lower index.
If you get an empty array/list, return an empty array/list.
Don't change the order of the elements that are left.
:param numbers: list
:return: list
"""
new_array: list = []

if len(numbers) > 0:
min_num: int = min(numbers)
min_i: int = numbers.index(min_num)
Expand Down
28 changes: 15 additions & 13 deletions kyu_7/remove_the_minimum/test_remove_the_minimum.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Test for -> The museum of incredible dull things
Test for -> The museum of incredible dull things.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand Down Expand Up @@ -28,22 +29,22 @@
name='Source/Kata')
# pylint: enable-msg=R0801
class RemoveSmallestTestCase(unittest.TestCase):
"""
Testing remove_smallest function
"""
"""Testing remove_smallest function."""

@staticmethod
def random_list():
"""
Helper function
Helper function.
:return:
"""
with allure.step("Create a random list"):
return list(randint(400, size=randint(1, 10)))

def test_remove_smallest(self):
"""
Test lists with multiple digits
Test lists with multiple digits.
:return:
"""
# pylint: disable-msg=R0801
Expand Down Expand Up @@ -77,7 +78,8 @@ def test_remove_smallest(self):

def test_remove_smallest_empty_list(self):
"""
Test with empty list
Test with empty list.
:return:
"""
# pylint: disable-msg=R0801
Expand All @@ -91,15 +93,15 @@ def test_remove_smallest_empty_list(self):
'<h3>Test Description:</h3>'
"<p></p>")
# pylint: enable-msg=R0801
with allure.step("Remove smallest value from "
"the empty list"):
with allure.step("Remove smallest value from the empty list"):
self.assertEqual(remove_smallest([]),
[],
"Wrong result for []")

def test_remove_smallest_one_element_list(self):
"""
Returns [] if list has only one element
Returns [] if list has only one element.
:return:
"""
# pylint: disable-msg=R0801
Expand All @@ -125,7 +127,8 @@ def test_remove_smallest_one_element_list(self):

def test_remove_smallest_random_list(self):
"""
Returns a list that misses only one element
Returns a list that misses only one element.
:return:
"""
# pylint: disable-msg=R0801
Expand All @@ -139,8 +142,7 @@ def test_remove_smallest_random_list(self):
'<h3>Test Description:</h3>'
"<p></p>")
# pylint: enable-msg=R0801
with allure.step("Remove smallest value from "
"the random list"):
with allure.step("Remove smallest value from the random list"):
i: int = 0
while i < 10:
arr = self.random_list()
Expand Down

0 comments on commit 3b64528

Please sign in to comment.