|
3 | 3 | from babel import lists
|
4 | 4 |
|
5 | 5 |
|
6 |
| -def test_format_list(): |
7 |
| - for list, locale, expected in [ |
8 |
| - ([], 'en', ''), |
9 |
| - (['string'], 'en', 'string'), |
10 |
| - (['string1', 'string2'], 'en', 'string1 and string2'), |
11 |
| - (['string1', 'string2', 'string3'], 'en', 'string1, string2, and string3'), |
12 |
| - (['string1', 'string2', 'string3'], 'zh', 'string1、string2和string3'), |
13 |
| - (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1,string2, string3 र string4'), |
14 |
| - ]: |
15 |
| - assert lists.format_list(list, locale=locale) == expected |
| 6 | +@pytest.mark.parametrize(('list', 'locale', 'expected'), [ |
| 7 | + ([], 'en', ''), |
| 8 | + (['string'], 'en', 'string'), |
| 9 | + (['string1', 'string2'], 'en', 'string1 and string2'), |
| 10 | + (['string1', 'string2', 'string3'], 'en', 'string1, string2, and string3'), |
| 11 | + (['string1', 'string2', 'string3'], 'zh', 'string1、string2和string3'), |
| 12 | + (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1,string2, string3 र string4'), |
| 13 | +]) |
| 14 | +def test_format_list(list, locale, expected): |
| 15 | + assert lists.format_list(list, locale=locale) == expected |
16 | 16 |
|
17 | 17 |
|
18 | 18 | def test_format_list_error():
|
|
0 commit comments