From: Aarni Koskela Date: Thu, 11 Jul 2024 10:43:22 +0000 (+0300) Subject: Use conventional parametrize in list tests X-Git-Tag: v2.16.0~12^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64e80281058a0dabcd8f2c435f4c109638c8b07d;p=thirdparty%2Fbabel.git Use conventional parametrize in list tests --- diff --git a/tests/test_lists.py b/tests/test_lists.py index ca9c6ab4..2b2453bb 100644 --- a/tests/test_lists.py +++ b/tests/test_lists.py @@ -3,16 +3,16 @@ import pytest from babel import lists -def test_format_list(): - for list, locale, expected in [ - ([], 'en', ''), - (['string'], 'en', 'string'), - (['string1', 'string2'], 'en', 'string1 and string2'), - (['string1', 'string2', 'string3'], 'en', 'string1, string2, and string3'), - (['string1', 'string2', 'string3'], 'zh', 'string1、string2和string3'), - (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1,string2, string3 र string4'), - ]: - assert lists.format_list(list, locale=locale) == expected +@pytest.mark.parametrize(('list', 'locale', 'expected'), [ + ([], 'en', ''), + (['string'], 'en', 'string'), + (['string1', 'string2'], 'en', 'string1 and string2'), + (['string1', 'string2', 'string3'], 'en', 'string1, string2, and string3'), + (['string1', 'string2', 'string3'], 'zh', 'string1、string2和string3'), + (['string1', 'string2', 'string3', 'string4'], 'ne', 'string1,string2, string3 र string4'), +]) +def test_format_list(list, locale, expected): + assert lists.format_list(list, locale=locale) == expected def test_format_list_error():