Skip to content

Commit 4a9fea4

Browse files
committed
Уроки тестирования
1 parent 9c16c98 commit 4a9fea4

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

tests/test_capitalize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from training.capitalize import capitalize
2+
3+
assert capitalize("") == ""
4+
assert capitalize("hello") == "Hello"
5+
6+
print("Все тесты пройдены!")

training/__init__.py

Whitespace-only changes.

training/capitalize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def capitalize(text):
2+
if text == "":
3+
return ""
4+
first_char = text[0].upper()
5+
rest_substring = text[1:]
6+
return f"{first_char}{rest_substring}"

0 commit comments

Comments
 (0)