Update the CityFormatter to have the header as an argument.
This commit is contained in:
@@ -10,3 +10,21 @@ def test_city_format():
|
||||
|
||||
assert '- Chernihiv\n' == city_fmt
|
||||
|
||||
def test_format_cities():
|
||||
cities = {'data': [
|
||||
{'name': 'Київ'},
|
||||
{'name': 'Чернігів'}
|
||||
]}
|
||||
|
||||
expected_format = "".join([
|
||||
"# Міста\n\n",
|
||||
"- Київ\n",
|
||||
"- Чернігів\n",
|
||||
])
|
||||
|
||||
formatter = CityFormatter()
|
||||
|
||||
cities_fmt = formatter.format_all(cities)
|
||||
|
||||
assert expected_format == cities_fmt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user