Ejemplo n.º 1
0
def _fixup_ulcase(space):
    stringmod = space.call_function(
        space.getattr(space.getbuiltinmodule('__builtin__'),
                      space.newtext('__import__')), space.newtext('string'))
    # create uppercase map string
    ul = []
    for c in xrange(256):
        if rlocale.isupper(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.newtext('uppercase'),
                  space.newbytes(''.join(ul)))

    # create lowercase string
    ul = []
    for c in xrange(256):
        if rlocale.islower(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.newtext('lowercase'),
                  space.newbytes(''.join(ul)))

    # create letters string
    ul = []
    for c in xrange(256):
        if rlocale.isalpha(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.newtext('letters'),
                  space.newbytes(''.join(ul)))
Ejemplo n.º 2
0
def _fixup_ulcase(space):
    stringmod = space.call_function(
        space.getattr(space.getbuiltinmodule('__builtin__'),
                      space.wrap('__import__')), space.wrap('string'))
    # create uppercase map string
    ul = []
    for c in xrange(256):
        if rlocale.isupper(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.wrap('uppercase'), space.wrap(''.join(ul)))

    # create lowercase string
    ul = []
    for c in xrange(256):
        if rlocale.islower(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.wrap('lowercase'), space.wrap(''.join(ul)))

    # create letters string
    ul = []
    for c in xrange(256):
        if rlocale.isalpha(c):
            ul.append(chr(c))
    space.setattr(stringmod, space.wrap('letters'), space.wrap(''.join(ul)))
Ejemplo n.º 3
0
 def test_lower_upper(self):
     assert isupper(ord("A"))
     assert islower(ord("a"))
     assert not isalpha(ord(" "))
     assert isalnum(ord("1"))
     assert tolower(ord("A")) == ord("a")
Ejemplo n.º 4
0
 def test_lower_upper(self):
     assert isupper(ord("A"))
     assert islower(ord("a"))
     assert not isalpha(ord(" "))
     assert isalnum(ord("1"))
     assert tolower(ord("A")) == ord("a")
Ejemplo n.º 5
0
 def fn():
     assert isupper(ord("A"))
     assert islower(ord("a"))
     assert not isalpha(ord(" "))
     assert isalnum(ord("1"))
     assert tolower(ord("A")) == ord("a")