mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
str.format_map tests don't do what they say: fix to actually implement the intent of the test. Closes #13450.
This commit is contained in:
parent
a7fccd8b14
commit
edbb6ca084
2 changed files with 10 additions and 6 deletions
|
@ -891,12 +891,15 @@ class UnicodeTest(string_tests.CommonTest,
|
||||||
self.assertEqual('{foo._x}'.format_map({'foo': C(20)}), '20')
|
self.assertEqual('{foo._x}'.format_map({'foo': C(20)}), '20')
|
||||||
|
|
||||||
# test various errors
|
# test various errors
|
||||||
self.assertRaises(TypeError, '{'.format_map)
|
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(ValueError, '{'.format_map, {})
|
||||||
self.assertRaises(TypeError, '{a'.format_map)
|
self.assertRaises(ValueError, '}'.format_map, {})
|
||||||
self.assertRaises(TypeError, '}a'.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
|
# issue #12579: can't supply positional params to format_map
|
||||||
self.assertRaises(ValueError, '{}'.format_map, {'a' : 2})
|
self.assertRaises(ValueError, '{}'.format_map, {'a' : 2})
|
||||||
|
|
|
@ -552,6 +552,7 @@ John Lenton
|
||||||
Christopher Tur Lesniewski-Laas
|
Christopher Tur Lesniewski-Laas
|
||||||
Mark Levinson
|
Mark Levinson
|
||||||
William Lewis
|
William Lewis
|
||||||
|
Akira Li
|
||||||
Xuanji Li
|
Xuanji Li
|
||||||
Robert van Liere
|
Robert van Liere
|
||||||
Ross Light
|
Ross Light
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue