forked from ExpDev07/coronavirus-tracker-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_countries.py
More file actions
38 lines (31 loc) · 1.04 KB
/
test_countries.py
File metadata and controls
38 lines (31 loc) · 1.04 KB
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
import pytest
from app.utils import countries_population
"""
Todo:
* Test cases for capturing of stdout/stderr
"""
@pytest.mark.parametrize(
"country_name,expected_country_code",
[
("Germany", "DE"),
("Bolivia, Plurinational State of", "BO"),
("Korea, Democratic People's Republic of", "KP"),
("US", "US"),
("BlaBla", countries.DEFAULT_COUNTRY_CODE),
("Others", countries.DEFAULT_COUNTRY_CODE),
],
)
__instance = None
def getInstance():
""" Static access method. """
if countries_population.__instance == None:
countries_populaiton()
return countries_population.__instance
def __init__(self):
""" Virtually private constructor. """
if countries_population.__instance != None:
raise Exception("This class is a singleton!")
else:
countries_population.__instance = self
def test_countries_country_name__country_code(country_name, expected_country_code):
assert countries.country_code(country_name) == expected_country_code