diff options
author | Eric V. Smith <eric@trueblade.com> | 2012-03-12 22:16:22 (GMT) |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2012-03-12 22:16:22 (GMT) |
commit | edbb6ca084b4446dcf6c78c942e875a3b16a4397 (patch) | |
tree | ebbfc79afc9843b33c56cf1c42db95a28fd420b9 /Lib | |
parent | a7fccd8b14885a76525e11baa1f9db7792d9a26c (diff) | |
download | cpython-edbb6ca084b4446dcf6c78c942e875a3b16a4397.zip cpython-edbb6ca084b4446dcf6c78c942e875a3b16a4397.tar.gz cpython-edbb6ca084b4446dcf6c78c942e875a3b16a4397.tar.bz2 |
str.format_map tests don't do what they say: fix to actually implement the intent of the test. Closes #13450.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 259a181..19b06a0 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -891,12 +891,15 @@ class UnicodeTest(string_tests.CommonTest, self.assertEqual('{foo._x}'.format_map({'foo': C(20)}), '20') # test various errors - self.assertRaises(TypeError, '{'.format_map) - self.assertRaises(TypeError, '}'.format_map) - self.assertRaises(TypeError, 'a{'.format_map) - self.assertRaises(TypeError, 'a}'.format_map) - self.assertRaises(TypeError, '{a'.format_map) - self.assertRaises(TypeError, '}a'.format_map) + self.assertRaises(TypeError, ''.format_map) + self.assertRaises(TypeError, 'a'.format_map) + + self.assertRaises(ValueError, '{'.format_map, {}) + self.assertRaises(ValueError, '}'.format_map, {}) + self.assertRaises(ValueError, 'a{'.format_map, {}) + self.assertRaises(ValueError, 'a}'.format_map, {}) + self.assertRaises(ValueError, '{a'.format_map, {}) + self.assertRaises(ValueError, '}a'.format_map, {}) # issue #12579: can't supply positional params to format_map self.assertRaises(ValueError, '{}'.format_map, {'a' : 2}) |