[Python-checkins] python/dist/src/Lib/test string_tests.py, 1.44, 1.45
doerwalter@users.sourceforge.net
doerwalter at users.sourceforge.net
Thu Jul 28 18:49:19 CEST 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7035/Lib/test
Modified Files:
string_tests.py
Log Message:
Disable encoding/decoding test, if unicode is disabled.
Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- string_tests.py 20 Feb 2005 09:54:53 -0000 1.44
+++ string_tests.py 28 Jul 2005 16:49:15 -0000 1.45
@@ -737,26 +737,27 @@
# Additional tests that only work with
# 8bit compatible object, i.e. str and UserString
- def test_encoding_decoding(self):
- codecs = [('rot13', 'uryyb jbeyq'),
- ('base64', 'aGVsbG8gd29ybGQ=\n'),
- ('hex', '68656c6c6f20776f726c64'),
- ('uu', 'begin 666 <data>\n+:&5L;&\\@=V]R;&0 \n \nend\n')]
- for encoding, data in codecs:
- self.checkequal(data, 'hello world', 'encode', encoding)
- self.checkequal('hello world', data, 'decode', encoding)
- # zlib is optional, so we make the test optional too...
- try:
- import zlib
- except ImportError:
- pass
- else:
- data = 'x\x9c\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x1a\x0b\x04]'
- self.checkequal(data, 'hello world', 'encode', 'zlib')
- self.checkequal('hello world', data, 'decode', 'zlib')
+ if test_support.have_unicode:
+ def test_encoding_decoding(self):
+ codecs = [('rot13', 'uryyb jbeyq'),
+ ('base64', 'aGVsbG8gd29ybGQ=\n'),
+ ('hex', '68656c6c6f20776f726c64'),
+ ('uu', 'begin 666 <data>\n+:&5L;&\\@=V]R;&0 \n \nend\n')]
+ for encoding, data in codecs:
+ self.checkequal(data, 'hello world', 'encode', encoding)
+ self.checkequal('hello world', data, 'decode', encoding)
+ # zlib is optional, so we make the test optional too...
+ try:
+ import zlib
+ except ImportError:
+ pass
+ else:
+ data = 'x\x9c\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x1a\x0b\x04]'
+ self.checkequal(data, 'hello world', 'encode', 'zlib')
+ self.checkequal('hello world', data, 'decode', 'zlib')
- self.checkraises(TypeError, 'xyz', 'decode', 42)
- self.checkraises(TypeError, 'xyz', 'encode', 42)
+ self.checkraises(TypeError, 'xyz', 'decode', 42)
+ self.checkraises(TypeError, 'xyz', 'encode', 42)
class MixinStrUnicodeTest:
More information about the Python-checkins
mailing list