Issue 13450: add assertions to implement the intent in ''.format_map test (original) (raw)
It seems that some assertions in Lib/test/test_unicode.py:UnicodeTest.test_format_map do not implement their intent e.g.,
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)
The intent might be to test:
'{'.format_map({}) Traceback (most recent call last): File "", line 1, in ValueError: Single '{' encountered in format string
But it actually tests:
'{'.format_map() Traceback (most recent call last): File "", line 1, in TypeError: format_map() takes exactly one argument (0 given)
Provided correct-assertions-in-test_format_map.patch contains additional assertions e.g.,
self.assertRaises(ValueError, '{'.format_map, {})
Old assertions might be useful so they're left untouched.