File: test_normalized_string.py

package info (click to toggle)
python-babel 2.8.0%2Bdfsg.1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 194,932 kB
  • sloc: xml: 2,069,184; python: 12,072; makefile: 197; sh: 36
file content (17 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from babel.messages.pofile import _NormalizedString


def test_normalized_string():
    ab1 = _NormalizedString('a', 'b ')
    ab2 = _NormalizedString('a', ' b')
    ac1 = _NormalizedString('a', 'c')
    ac2 = _NormalizedString('  a', 'c  ')
    z = _NormalizedString()
    assert ab1 == ab2 and ac1 == ac2  # __eq__
    assert ab1 < ac1  # __lt__
    assert ac1 > ab2  # __gt__
    assert ac1 >= ac2  # __ge__
    assert ab1 <= ab2  # __le__
    assert ab1 != ac1  # __ne__
    assert not z  # __nonzero__ / __bool__
    assert sorted([ab1, ab2, ac1])  # the sort order is not stable so we can't really check it, just that we can sort