예제 #1
0
    def test_strxfrm(self):
        # TODO more tests would be nice
        import _locale

        _locale.setlocale(_locale.LC_ALL, "C")
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b
        assert a == b

        raises(TypeError, _locale.strxfrm, 1)

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b
예제 #2
0
파일: test_locale.py 프로젝트: njues/Sypy
    def test_strxfrm(self):
        # TODO more tests would be nice
        import _locale

        _locale.setlocale(_locale.LC_ALL, "C")
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b
        assert a == b

        raises(TypeError, _locale.strxfrm, 1)

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b
예제 #3
0
def test_strxfrm():
    str1 = "this is a test !"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = "this is a test&^%%^$%$ !"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = "this \" \"is a test&^%%^$%$ !"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = "123456789"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    #argument is int type
    i = 12
    AssertError(TypeError, _locale.strxfrm, i)

    #argument is random type
    obj = _random.Random()
    AssertError(TypeError, _locale.strxfrm, obj)
예제 #4
0
    def test_strxfrm(self):
        str1 = "this is a test !"
        str2 = _locale.strxfrm(str1)
        str1.__eq__(str2)

        str1 = "this is a test&^%%^$%$ !"
        str2 = _locale.strxfrm(str1)
        str1.__eq__(str2)

        str1 = "this \" \"is a test&^%%^$%$ !"
        str2 = _locale.strxfrm(str1)
        str1.__eq__(str2)

        str1 = "123456789"
        str2 = _locale.strxfrm(str1)
        str1.__eq__(str2)

        #argument is int type
        i = 12
        self.assertRaises(TypeError, _locale.strxfrm, i)

        #argument is random type
        obj = random.Random()
        self.assertRaises(TypeError, _locale.strxfrm, obj)
예제 #5
0
 def test_strxfrm(self):
     str1 = "this is a test !"
     str2 = _locale.strxfrm(str1)
     cmp(str1,str2)
     
     str1 = "this is a test&^%%^$%$ !"
     str2 = _locale.strxfrm(str1)
     cmp(str1,str2)
     
     str1 = "this \" \"is a test&^%%^$%$ !"
     str2 = _locale.strxfrm(str1)
     cmp(str1,str2)
     
     str1 = "123456789"
     str2 = _locale.strxfrm(str1)
     cmp(str1,str2)
     
     #argument is int type
     i = 12
     self.assertRaises(TypeError,_locale.strxfrm,i)
     
     #argument is random type
     obj = random.Random()
     self.assertRaises(TypeError,_locale.strxfrm,obj)
예제 #6
0
def test_strxfrm():
    str1 = "this is a test !"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = "this is a test&^%%^$%$ !"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = 'this " "is a test&^%%^$%$ !'
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    str1 = "123456789"
    str2 = _locale.strxfrm(str1)
    cmp(str1, str2)

    # argument is int type
    i = 12
    AssertError(TypeError, _locale.strxfrm, i)

    # argument is random type
    obj = _random.Random()
    AssertError(TypeError, _locale.strxfrm, obj)
예제 #7
0
    def test_strxfrm(self):
        # TODO more tests would be nice
        import _locale

        _locale.setlocale(_locale.LC_ALL, "C")
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b
        assert a == b

        with raises(TypeError):
            _locale.strxfrm(1)
        with raises(ValueError):
            _locale.strxfrm("a\x00b")

        _locale.setlocale(_locale.LC_ALL, self.language_pl)
        a = "1234"
        b = _locale.strxfrm(a)
        assert a is not b