Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e8804a9

Browse files
committed
Add pep8 format
1 parent 00cfde2 commit e8804a9

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

‎python_tests/test_1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
def get_hello_world() -> str:
66
return "Hello, World!"
77

8+
89
# Test Section
910
def test_hello_world():
1011
expected_string = "Hello, World!"

‎python_tests/test_2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
# Implementation
55
def get_even_numbers(n: int) -> []:
6-
even_number = lambda x: x % 2 == 0
7-
even_number_list = filter(even_number, range(1, n))
6+
even_number_list = filter(lambda x: x % 2 == 0, range(1, n))
87
return list(even_number_list)
98

109

@@ -18,4 +17,4 @@ def test_even_numbers_10():
1817
def test_even_numbers_20():
1918
n = 20
2019
expected_list = [2, 4, 6, 8, 10, 12, 14, 16, 18]
21-
assert get_even_numbers(n) == expected_list
20+
assert get_even_numbers(n) == expected_list

‎python_tests/test_3.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_fibonacci_recursive(n: int) -> int:
1313

1414
def get_fibonacci_iterative(n: int) -> int:
1515
fibonacci_first, fibonacci_second = 0, 1
16-
for i in range(1, n+1):
16+
for i in range(1, n+1):
1717
fibonacci_first, fibonacci_second = fibonacci_second, fibonacci_first + fibonacci_second
1818
return fibonacci_first
1919

@@ -30,6 +30,7 @@ def test_fibonacci_recursive_bigger():
3030
expected_value = 6765
3131
assert get_fibonacci_recursive(n) == expected_value
3232

33+
3334
def test_fibonacci_iterative_small():
3435
n = 7
3536
expected_value = 13
@@ -39,4 +40,4 @@ def test_fibonacci_iterative_small():
3940
def test_fibonacci_iterative_bigger():
4041
n = 20
4142
expected_value = 6765
42-
assert get_fibonacci_iterative(n) == expected_value
43+
assert get_fibonacci_iterative(n) == expected_value

‎python_tests/test_5.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
# Task 5
2+
# Write a program to reverse a string
13
import pytest
24

35

4-
def reverse_string(input):
5-
if not input:
6+
def reverse_string(message):
7+
if not message:
68
raise Exception("String cannot be empty")
7-
if not input.isascii():
9+
if not message.isascii():
810
raise Exception("String cannot be digits or other special characters")
9-
tmp = input.split(" ")
11+
tmp = message.split(" ")
1012
return " ".join(tmp[::-1])
1113

1214

@@ -23,6 +25,6 @@ def test_reverse_string_empty():
2325

2426

2527
def test_reverse_string_with_bool():
26-
input_string = True
28+
message = True
2729
with pytest.raises(Exception):
28-
reverse_string(input_string)
30+
reverse_string(message)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /