|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | # vim: ai ts=4 sts=4 et sw=4 nu |
3 | 3 |
|
4 | | -import locale |
5 | | -import pathlib |
6 | 4 | from unittest.mock import Mock |
7 | 5 |
|
8 | 6 | import pytest |
9 | 7 |
|
10 | 8 | from zimscraperlib.i18n import ( |
11 | 9 | Lang, |
12 | 10 | NotFoundError, |
13 | | - _, |
14 | 11 | find_language_names, |
15 | 12 | get_language_details, |
16 | | - setlocale, |
17 | 13 | ) |
18 | 14 |
|
19 | 15 |
|
20 | | -@pytest.mark.parametrize( |
21 | | - "code,expected", |
22 | | - [("en", "en_US.UTF-8"), ("en_us", "en_US.UTF-8"), ("en.utf8", "en_US.UTF-8")], |
23 | | -) |
24 | | -def test_setlocale(tmp_path, code, expected): |
25 | | - assert setlocale(tmp_path, code) == expected |
26 | | - |
27 | | - |
28 | | -def test_selocale_unsupported(tmp_path): |
29 | | - with pytest.raises(locale.Error): |
30 | | - setlocale(tmp_path, "bam") |
31 | | - |
32 | | - |
33 | 16 | @pytest.mark.parametrize( |
34 | 17 | "query,expected", |
35 | 18 | [ |
@@ -222,15 +205,6 @@ def test_lang_name(query, expected): |
222 | 205 | assert find_language_names(query) == expected |
223 | 206 |
|
224 | 207 |
|
225 | | -@pytest.mark.parametrize( |
226 | | - "lang,expected", |
227 | | - [("en", "Hello World!"), ("fr", "Bonjour monde !"), ("pt_BR.utf8", "Olá Mundo!")], |
228 | | -) |
229 | | -def test_translation(lang, expected): |
230 | | - setlocale(pathlib.Path(__file__).parent, lang) |
231 | | - assert _("Hello World!") == expected |
232 | | - |
233 | | - |
234 | 208 | @pytest.mark.parametrize( |
235 | 209 | "dict_data", |
236 | 210 | [{}, {"iso-639-1": "ar"}], |
|
0 commit comments