FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
materials/debug-python-errors/test_fruit.py at master · realpython/materials · GitHub
realpython
materials
Repository navigation
Code
Issues
39
(39)
Pull requests
60
(60)
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
materials
/
debug-python-errors
/
test_fruit.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (32 loc) · 1.07 KB
Breadcrumbs
materials
/
debug-python-errors
/
test_fruit.py
Copy path
File metadata and controls
41 lines (32 loc) · 1.07 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import
unittest
from
fruit
import
capitalize_fruit_names
class
TestFruit
(
unittest
.
TestCase
):
def
test_empty_list
(
self
):
"""with empty list"""
self
.
assertEqual
(
capitalize_fruit_names
([]), [])
def
test_lowercase
(
self
):
"""with lowercase strings"""
self
.
assertEqual
(
capitalize_fruit_names
([
"apple"
,
"banana"
,
"cherry"
]),
[
"Apple"
,
"Banana"
,
"Cherry"
],
)
def
test_uppercase
(
self
):
"""with uppercase strings"""
self
.
assertEqual
(
capitalize_fruit_names
([
"APPLE"
,
"BANANA"
,
"CHERRY"
]),
[
"Apple"
,
"Banana"
,
"Cherry"
],
)
def
test_mixed_case
(
self
):
"""with mixed case strings"""
self
.
assertEqual
(
capitalize_fruit_names
([
"mAnGo"
,
"grApE"
]),
[
"Mango"
,
"Grape"
],
)
def
test_non_string_element
(
self
):
"""with a mix of integer and string elements"""
self
.
assertEqual
(
capitalize_fruit_names
([
123
,
"banana"
]),
[
""
,
"Banana"
],
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL