Sha256: c4b688c49635ed8e39d7b221fed4decfc544fc7e6471fe6c1a08a7b13d4e9770

Contents?: true

Size: 1.2 KB

Versions: 30

Compression:

Stored size: 1.2 KB

Contents

""" Python character mapping codec test

This uses the test codec in testcodec.py and thus also tests the
encodings package lookup scheme.

Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright 2000 Guido van Rossum.

"""#"

def check(a, b):
    if a != b:
        print '*** check failed: %s != %s' % (repr(a), repr(b))
    else:
        print '%s == %s: OK' % (a, b)

# test codec's full path name (see test/testcodec.py)
codecname = 'test.testcodec'

check(unicode('abc', codecname), u'abc')
check(unicode('xdef', codecname), u'abcdef')
check(unicode('defx', codecname), u'defabc')
check(unicode('dxf', codecname), u'dabcf')
check(unicode('dxfx', codecname), u'dabcfabc')

check(u'abc'.encode(codecname), 'abc')
check(u'xdef'.encode(codecname), 'abcdef')
check(u'defx'.encode(codecname), 'defabc')
check(u'dxf'.encode(codecname), 'dabcf')
check(u'dxfx'.encode(codecname), 'dabcfabc')

check(unicode('ydef', codecname), u'def')
check(unicode('defy', codecname), u'def')
check(unicode('dyf', codecname), u'df')
check(unicode('dyfy', codecname), u'df')

try:
    unicode('abc\001', codecname)
except UnicodeError:
    print '\\001 maps to undefined: OK'
else:
    print '*** check failed: \\001 does not map to undefined'

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_charmapcodec.py