File: test_units.py

package info (click to toggle)
python-babel 2.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,888 kB
  • sloc: python: 14,521; makefile: 177; javascript: 77; sh: 8
file content (19 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import pytest

from babel.units import format_unit


# New units in CLDR 46
@pytest.mark.parametrize(('unit', 'count', 'expected'), [
    ('speed-light-speed', 1, '1 světlo'),
    ('speed-light-speed', 2, '2 světla'),
    ('speed-light-speed', 5, '5 světel'),
    ('concentr-portion-per-1e9', 1, '1 částice na miliardu'),
    ('concentr-portion-per-1e9', 2, '2 částice na miliardu'),
    ('concentr-portion-per-1e9', 5, '5 částic na miliardu'),
    ('duration-night', 1, '1 noc'),
    ('duration-night', 2, '2 noci'),
    ('duration-night', 5, '5 nocí'),
])
def test_new_cldr46_units(unit, count, expected):
    assert format_unit(count, unit, locale='cs_CZ') == expected