From 1d08d44d6f95233f3af542ee05e6dc4e20b60035 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 17 Dec 2024 05:23:34 -0800 Subject: [PATCH] # Pyramid Array --- kyu_6/pyramid_array/__init__.py | 1 + kyu_6/pyramid_array/pyramid_array.py | 5 ++++- kyu_6/pyramid_array/test_pyramid_array.py | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/kyu_6/pyramid_array/__init__.py b/kyu_6/pyramid_array/__init__.py index e69de29bb2d..ee4ddb671fb 100644 --- a/kyu_6/pyramid_array/__init__.py +++ b/kyu_6/pyramid_array/__init__.py @@ -0,0 +1 @@ +"""Pyramid Array.""" diff --git a/kyu_6/pyramid_array/pyramid_array.py b/kyu_6/pyramid_array/pyramid_array.py index 744b8e85abd..31f35c98ab6 100644 --- a/kyu_6/pyramid_array/pyramid_array.py +++ b/kyu_6/pyramid_array/pyramid_array.py @@ -1,5 +1,6 @@ """ -Solution for -> Pyramid Array +Solution for -> Pyramid Array. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -7,6 +8,8 @@ def pyramid(n: int) -> list: """ + Pyramid function. + Write a function that when given a number >= 0, returns an Array of ascending length subarrays. diff --git a/kyu_6/pyramid_array/test_pyramid_array.py b/kyu_6/pyramid_array/test_pyramid_array.py index 1ab3cc3e595..8ebf6e90c61 100644 --- a/kyu_6/pyramid_array/test_pyramid_array.py +++ b/kyu_6/pyramid_array/test_pyramid_array.py @@ -1,5 +1,6 @@ """ -Test for -> Pyramid Array +Test for -> Pyramid Array. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -25,15 +26,16 @@ name='Source/Kata') # pylint: enable-msg=R0801 class PyramidTestCase(unittest.TestCase): - """ - Testing 'pyramid' function - """ + """Testing 'pyramid' function.""" + def test_pyramid(self): """ + Testing 'pyramid' function with various test data. + The 'pyramid' function should return - an Array of ascending length subarrays. + an Array of ascending length sub-arrays. - Note: the subarrays should be filled with 1s. + Note: the sub-arrays should be filled with 1s. :return: """ # pylint: disable-msg=R0801 @@ -46,25 +48,25 @@ def test_pyramid(self): '

Test Description:

' "

") # pylint: enable-msg=R0801 - with allure.step("Pass zero"): + with allure.step("Pass zero:"): n: int = 0 expected: list = [] print_log(n=n, expected=expected) self.assertEqual(pyramid(n), expected) - with allure.step("Pass one"): + with allure.step("Pass one:"): n = 1 expected = [[1]] print_log(n=n, expected=expected) self.assertEqual(pyramid(n), expected) - with allure.step("Pass two"): + with allure.step("Pass two:"): n = 2 expected = [[1], [1, 1]] print_log(n=n, expected=expected) self.assertEqual(pyramid(n), expected) - with allure.step("Pass three"): + with allure.step("Pass three:"): n = 3 expected = [[1], [1, 1], [1, 1, 1]] print_log(n=n, expected=expected)