diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 08:21:43 +0000 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 08:21:43 +0000 |
commit | 60d512c3b01405f91872a62126d42b4bf1bea911 (patch) | |
tree | 47af206a9737b23605ec0a90eb52892bb6ee408e /Lib/test/test_str.py | |
parent | 3fa3b001bf53df3aa6cc64eaf35bcf090db6b43e (diff) | |
download | cpython-git-60d512c3b01405f91872a62126d42b4bf1bea911.tar.gz |
Check PendingDeprecationWarning after issue #7994.
Diffstat (limited to 'Lib/test/test_str.py')
-rw-r--r-- | Lib/test/test_str.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py index fa86db413b..4f88b28848 100644 --- a/Lib/test/test_str.py +++ b/Lib/test/test_str.py @@ -276,7 +276,7 @@ class StrTest( # format specifiers for user defined type self.assertEqual('{0:abc}'.format(C()), 'abc') - # !r and !s coersions + # !r and !s coercions self.assertEqual('{0!s}'.format('Hello'), 'Hello') self.assertEqual('{0!s:}'.format('Hello'), 'Hello') self.assertEqual('{0!s:15}'.format('Hello'), 'Hello ') @@ -290,12 +290,15 @@ class StrTest( self.assertEqual('{0}'.format([]), '[]') self.assertEqual('{0}'.format([1]), '[1]') self.assertEqual('{0}'.format(E('data')), 'E(data)') - self.assertEqual('{0:^10}'.format(E('data')), ' E(data) ') - self.assertEqual('{0:^10s}'.format(E('data')), ' E(data) ') self.assertEqual('{0:d}'.format(G('data')), 'G(data)') - self.assertEqual('{0:>15s}'.format(G('data')), ' string is data') self.assertEqual('{0!s}'.format(G('data')), 'string is data') + msg = 'object.__format__ with a non-empty format string is deprecated' + with test_support.check_warnings((msg, PendingDeprecationWarning)): + self.assertEqual('{0:^10}'.format(E('data')), ' E(data) ') + self.assertEqual('{0:^10s}'.format(E('data')), ' E(data) ') + self.assertEqual('{0:>15s}'.format(G('data')), ' string is data') + self.assertEqual("{0:date: %Y-%m-%d}".format(I(year=2007, month=8, day=27)), |