summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-06-13 12:05:36 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-06-13 12:05:36 (GMT)
commit846257382602e1579b041073ae469bf990873b04 (patch)
treecffc8fba618aae60ab3662a473cd1d29510b5c89 /Lib
parent7ebb92ea668d32001576577b4982a32ac8f55ff1 (diff)
downloadcpython-846257382602e1579b041073ae469bf990873b04.zip
cpython-846257382602e1579b041073ae469bf990873b04.tar.gz
cpython-846257382602e1579b041073ae469bf990873b04.tar.bz2
Marc-Andre Lemburg <mal@lemburg.com>:
Fixed some tests to not cause the script to fail, but rather output a warning (which then is caught by regrtest.py as wrong output). This is needed to make test_unicode.py run through on JPython. Thanks to Finn Bock.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_unicode.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 15d87d6..237583e 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -251,9 +251,18 @@ assert u"%c" % (u"a",) == u'a'
assert u"%c" % ("a",) == u'a'
assert u"%c" % (34,) == u'"'
assert u"%c" % (36,) == u'$'
-assert u"%r, %r" % (u"abc", "abc") == u"u'abc', 'abc'"
+value = u"%r, %r" % (u"abc", "abc")
+if value != u"u'abc', 'abc'":
+ print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")'
+
assert u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"} == u'abc, def'
-assert u"%(x)s, %(ä)s" % {'x':u"abc", u'ä'.encode('utf-8'):"def"} == u'abc, def'
+try:
+ value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä'.encode('utf-8'):"def"}
+except KeyError:
+ print '*** formatting failed for "%s"' % "u'abc, def'"
+else:
+ assert value == u'abc, def'
+
# formatting jobs delegated from the string implementation:
assert '...%(foo)s...' % {'foo':u"abc"} == u'...abc...'
assert '...%(foo)s...' % {'foo':"abc"} == '...abc...'
@@ -268,7 +277,7 @@ try:
except ValueError:
pass
else:
- raise AssertionError, "'...%s...äöü...' % u'abc' failed to raise an exception"
+ print "*** formatting failed ...%s...äöü...' % u'abc' failed to raise an exception"
print 'done.'
# Test builtin codecs