Skip to content

Commit

Permalink
==kyu_7.powers_of_3
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.powers_of_3.test_largest_power:[33:40]
==kyu_7.sum_of_two_lowest_int.test_sum_two_smallest_numbers:[30:37]
        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 24, 2024
1 parent 2226880 commit 7999db8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
9 changes: 5 additions & 4 deletions kyu_7/powers_of_3/largest_power.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 -> Powers of 3
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def largestPower(N: int) -> int:
Expand All @@ -11,7 +13,6 @@ def largestPower(N: int) -> int:
:param N:
:return:
"""

result: int = 0
n: int = 0
while result < N:
Expand Down
49 changes: 29 additions & 20 deletions kyu_7/powers_of_3/test_largest_power.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
"""
Test for -> Powers of 3
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""

# ALGORITHMS LOOPS CONTROL FLOW BASIC LANGUAGE FEATURES FUNDAMENTALS MATHEMATICS NUMBERS
# ALGORITHMS LOOPS CONTROL FLOW BASIC LANGUAGE FEATURES
# FUNDAMENTALS MATHEMATICS NUMBERS

import unittest
import allure
Expand All @@ -16,9 +19,16 @@
@allure.sub_suite("Unit Tests")
@allure.feature("Flow Control")
@allure.story('Powers of 3')
@allure.tag()
@allure.link(url='',
name='Source/Kata')
@allure.tag('ALGORITHMS',
'LOOPS',
'CONTROL FLOW',
'BASIC LANGUAGE FEATURES',
'FUNDAMENTALS',
'MATHEMATICS',
'NUMBERS')
@allure.link(
url='https://www.codewars.com/kata/57be674b93687de78c0001d9/train/python',
name='Source/Kata')
class LargestPowerTestCase(unittest.TestCase):
"""
Testing largestPower function
Expand All @@ -29,25 +39,24 @@ def test_largest_power(self):
Testing largestPower function
:return:
"""

# pylint: disable-msg=R0801
allure.dynamic.title("Testing largestPower 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("Pass an integer and verify the output"):
n = 3
expected = 0

n: int = 3

Check notice on line 53 in kyu_7/powers_of_3/test_largest_power.py

View check run for this annotation

codefactor.io / CodeFactor

kyu_7/powers_of_3/test_largest_power.py#L53

Variable name "n" doesn't conform to snake_case naming style (invalid-name)
expected: int = 0
print_log(N=n, expected=expected)
self.assertEqual(largestPower(n), expected)

with allure.step("Pass an integer and verify the output"):
n = 4
expected = 1

n: int = 4

Check notice on line 59 in kyu_7/powers_of_3/test_largest_power.py

View check run for this annotation

codefactor.io / CodeFactor

kyu_7/powers_of_3/test_largest_power.py#L59

Variable name "n" doesn't conform to snake_case naming style (invalid-name)
expected: int = 1
print_log(N=n, expected=expected)
self.assertEqual(largestPower(n), expected)

0 comments on commit 7999db8

Please sign in to comment.