mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 23:08:07 -04:00
move formatted_list to utils
This commit is contained in:
committed by
Chris Hill-Scott
parent
b0a995beb2
commit
a037cd53c8
@@ -1,23 +0,0 @@
|
||||
import pytest
|
||||
|
||||
from flask import Markup
|
||||
from app import formatted_list
|
||||
|
||||
|
||||
@pytest.mark.parametrize('items, kwargs, expected_output', [
|
||||
([1], {}, '‘1’'),
|
||||
([1, 2], {}, '‘1’ and ‘2’'),
|
||||
([1, 2, 3], {}, '‘1’, ‘2’ and ‘3’'),
|
||||
([1, 2, 3], {'prefix': 'foo', 'prefix_plural': 'bar'}, 'bar ‘1’, ‘2’ and ‘3’'),
|
||||
([1], {'prefix': 'foo', 'prefix_plural': 'bar'}, 'foo ‘1’'),
|
||||
([1, 2, 3], {'before_each': 'a', 'after_each': 'b'}, 'a1b, a2b and a3b'),
|
||||
([1, 2, 3], {'conjunction': 'foo'}, '‘1’, ‘2’ foo ‘3’'),
|
||||
(['&'], {'before_each': '<i>', 'after_each': '</i>'}, '<i>&</i>'),
|
||||
([1, 2, 3], {'before_each': '<i>', 'after_each': '</i>'}, '<i>1</i>, <i>2</i> and <i>3</i>'),
|
||||
])
|
||||
def test_formatted_list(items, kwargs, expected_output):
|
||||
assert formatted_list(items, **kwargs) == expected_output
|
||||
|
||||
|
||||
def test_formatted_list_returns_markup():
|
||||
assert isinstance(formatted_list([0]), Markup)
|
||||
Reference in New Issue
Block a user