Commit 7751d5ed authored by Marc-André Lemburg's avatar Marc-André Lemburg

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.
parent 1e8c54ba
...@@ -251,9 +251,18 @@ assert u"%c" % (u"a",) == u'a' ...@@ -251,9 +251,18 @@ assert u"%c" % (u"a",) == u'a'
assert u"%c" % ("a",) == u'a' assert u"%c" % ("a",) == u'a'
assert u"%c" % (34,) == u'"' assert u"%c" % (34,) == u'"'
assert u"%c" % (36,) == 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, %(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: # formatting jobs delegated from the string implementation:
assert '...%(foo)s...' % {'foo':u"abc"} == u'...abc...' assert '...%(foo)s...' % {'foo':u"abc"} == u'...abc...'
assert '...%(foo)s...' % {'foo':"abc"} == '...abc...' assert '...%(foo)s...' % {'foo':"abc"} == '...abc...'
...@@ -268,7 +277,7 @@ try: ...@@ -268,7 +277,7 @@ try:
except ValueError: except ValueError:
pass pass
else: else:
raise AssertionError, "'...%s......' % u'abc' failed to raise an exception" print "*** formatting failed ...%s......' % u'abc' failed to raise an exception"
print 'done.' print 'done.'
# Test builtin codecs # Test builtin codecs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment