From 7e6d0be998929659dbd5cdb2ac5deae6381babd3 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 24 Dec 2024 02:57:05 -0800 Subject: [PATCH] Formatting decimal places #0 --- kyu_8/formatting_decimal_places_0/__init__.py | 1 + .../test_two_decimal_places.py | 46 +++++++++---------- .../two_decimal_places.py | 5 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/kyu_8/formatting_decimal_places_0/__init__.py b/kyu_8/formatting_decimal_places_0/__init__.py index e69de29bb2d..1ced7a92204 100644 --- a/kyu_8/formatting_decimal_places_0/__init__.py +++ b/kyu_8/formatting_decimal_places_0/__init__.py @@ -0,0 +1 @@ +"""Formatting decimal places #0.""" diff --git a/kyu_8/formatting_decimal_places_0/test_two_decimal_places.py b/kyu_8/formatting_decimal_places_0/test_two_decimal_places.py index d25a74b52da..057315550ba 100644 --- a/kyu_8/formatting_decimal_places_0/test_two_decimal_places.py +++ b/kyu_8/formatting_decimal_places_0/test_two_decimal_places.py @@ -1,5 +1,6 @@ """ -Test for -> Formatting decimal places #0 +Test for -> Formatting decimal places #0. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -8,6 +9,7 @@ import unittest import allure +from parameterized import parameterized from utils.log_func import print_log from kyu_8.formatting_decimal_places_0.two_decimal_places \ import two_decimal_places @@ -29,14 +31,21 @@ name='Source/Kata') # pylint: enable=R0801 class TwoDecimalPlacesTestCase(unittest.TestCase): - """ - Testing two_decimal_places function - """ + """Testing two_decimal_places function.""" - def test_two_decimal_places(self): + @parameterized.expand([ + (4.659725356, + 4.66, + "didn't work for 4.659725356"), + (173735326.3783732637948948, + 173735326.38, + "didn't work for 173735326.3783732637948948"), + (4.653725356, + 4.65, + "didn't work for 4.653725356")]) + def test_two_decimal_places(self, n, expected, msg): """ - Testing two_decimal_places function - with various test inputs. + Testing two_decimal_places function with various test inputs. Each number should be formatted that it is rounded to two decimal places. You don't @@ -50,25 +59,12 @@ def test_two_decimal_places(self): allure.dynamic.severity(allure.severity_level.NORMAL) allure.dynamic.description_html( '