t284.py

00001 # This file is Copyright 2010 Dean Hall.
00002 #
00003 # This file is part of the Python-on-a-Chip program.
00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify
00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
00006 #
00007 # Python-on-a-Chip is distributed in the hope that it will be useful,
00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
00011 # is seen in the file COPYING up one directory from this.
00012 
00013 #
00014 # System Test 284
00015 #
00016 
00017 print "Exercising string.join()"
00018 
00019 import string
00020 
00021 
00022 assert string.join('') == ''
00023 assert string.join('','') == ''
00024 assert string.join("foo",'') == "foo"
00025 
00026 
00027 e1 = ()
00028 e2 = []
00029 t = ("check", "this", "out")
00030 l = ["check", "this", "out"]
00031 j = ('', '\x00', '\x04', '\n', ' ', '!', '\xff', "foo")
00032 
00033 for c in j:
00034     je1 = string.join(e1, c)
00035     je2 = string.join(e2, c)
00036     assert je1 == ''
00037     assert je2 == ''
00038 
00039     jt = string.join(t, c)
00040     jl = string.join(l, c)
00041     print jt
00042     assert jt == jl
00043 
00044     jt = string.join(t)
00045     jl = string.join(l)
00046     assert jt == jl
00047 
00048 
00049 assert string.join("chicken", 'Z') == "cZhZiZcZkZeZn"

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9