Ejemplo n.º 1
0
 def collate(self,str1,str2,result):
     if result ==0:
         self.assertTrue(_locale.strcoll(str1,str2)==0, "expected that collating \" %r \" and \" %r \" result should greater than zero" % (str1, str2))
     elif result>0:
         self.assertTrue(_locale.strcoll(str1,str2)>0, "expected that collating \" %r \" and \" %r \" result should greater than zero" % (str1, str2))
     elif result<0:
         self.assertTrue(_locale.strcoll(str1,str2)<0, "expected that collating \" %r \" and \" %r \" result should less than zero" % (str1, str2))
Ejemplo n.º 2
0
 def collate(self,str1,str2,result):
     if result ==0:
         self.assertTrue(_locale.strcoll(str1,str2)==0, "expected that collating \" %r \" and \" %r \" result should greater than zero" % (str1, str2))
     elif result>0:
         self.assertTrue(_locale.strcoll(str1,str2)>0, "expected that collating \" %r \" and \" %r \" result should greater than zero" % (str1, str2))
     elif result<0:
         self.assertTrue(_locale.strcoll(str1,str2)<0, "expected that collating \" %r \" and \" %r \" result should less than zero" % (str1, str2))
Ejemplo n.º 3
0
    def test_strcoll_unicode(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll(u"b", u"b") == 0
        assert _locale.strcoll(u"a", u"b") < 0
        assert _locale.strcoll(u"b", u"a") > 0

        raises(TypeError, _locale.strcoll, 1, u"b")
        raises(TypeError, _locale.strcoll, u"b", 1)
Ejemplo n.º 4
0
    def test_strcoll_unicode(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll(u"b", u"b") == 0
        assert _locale.strcoll(u"a", u"b") < 0
        assert _locale.strcoll(u"b", u"a") > 0

        raises(TypeError, _locale.strcoll, 1, u"b")
        raises(TypeError, _locale.strcoll, u"b", 1)
Ejemplo n.º 5
0
    def test_strcoll(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll("a", "b") < 0
        assert _locale.strcoll("ą", "b") < 0

        assert _locale.strcoll("ć", "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)
Ejemplo n.º 6
0
    def test_strcoll(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll("a", "b") < 0
        assert _locale.strcoll("\N{LATIN SMALL LETTER A WITH OGONEK}", "b") < 0

        assert _locale.strcoll("\N{LATIN SMALL LETTER C WITH ACUTE}", "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)
Ejemplo n.º 7
0
    def test_strcoll(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll("a", "b") < 0
        assert _locale.strcoll("ą", "b") < 0

        assert _locale.strcoll("ć", "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)
Ejemplo n.º 8
0
def collate(str1, str2, result):
    if result == 0:
        Assert(
            _locale.strcoll(str1, str2) == 0,
            'expected that collating " %r " and " %r " result should greater than zero' % (str1, str2),
        )
    elif result > 0:
        Assert(
            _locale.strcoll(str1, str2) > 0,
            'expected that collating " %r " and " %r " result should greater than zero' % (str1, str2),
        )
    elif result < 0:
        Assert(
            _locale.strcoll(str1, str2) < 0,
            'expected that collating " %r " and " %r " result should less than zero' % (str1, str2),
        )
Ejemplo n.º 9
0
    def test_strcoll(self):
        import _locale

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        assert _locale.strcoll("a", "b") < 0
        assert _locale.strcoll(
            u"\N{LATIN SMALL LETTER A WITH OGONEK}".encode(self.encoding_pl),
            "b") < 0

        assert _locale.strcoll(
            u"\N{LATIN SMALL LETTER C WITH ACUTE}".encode(self.encoding_pl),
            "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)