diff options
Diffstat (limited to 'pypy/module/_locale/test/test_locale.py')
-rw-r--r-- | pypy/module/_locale/test/test_locale.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pypy/module/_locale/test/test_locale.py b/pypy/module/_locale/test/test_locale.py index 6b70c5b2ab..1f3dad1b97 100644 --- a/pypy/module/_locale/test/test_locale.py +++ b/pypy/module/_locale/test/test_locale.py @@ -92,6 +92,33 @@ class AppTestLocaleTrivia: for k, v in lconv_c.items(): assert lconv[k] == v + def test_strcoll(self): + import _locale + + _locale.setlocale(_locale.LC_ALL, "pl_PL.UTF-8") + assert _locale.strcoll("a", "b") < 0 + assert _locale.strcoll('\xc4\x85', "b") < 0 + + assert _locale.strcoll('\xc4\x87', "b") > 0 + assert _locale.strcoll("c", "b") > 0 + + assert _locale.strcoll("b", "b") == 0 + + raises(TypeError, _locale.strcoll, 1, "b") + raises(TypeError, _locale.strcoll, "b", 1) + + def test_strcoll_unicode(self): + skip("not implemented, rffi.unicode2wcharp needed") + import _locale + + _locale.setlocale(_locale.LC_ALL, "pl_PL.UTF-8") + assert _locale.strcoll(u"b", u"b") == 0 + assert _locale.strcoll(u'\xc4\x85', "b") < 0 + assert _locale.strcoll(u'\xc4\x87', "b") > 0 + + raises(TypeError, _locale.strcoll, 1, u"b") + raises(TypeError, _locale.strcoll, u"b", 1) + def test_str_float(self): import _locale import locale |