[issue13450] fix ''.format_map test

akira report at bugs.python.org
Tue Nov 22 01:42:36 CET 2011


New submission from akira <4kir4.1i at gmail.com>:

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 "<stdin>", line 1, in <module>
  ValueError: Single '{' encountered in format string

But it actually tests:

  >>> '{'.format_map()
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  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.

----------
components: Tests
files: correct-assertions-in-test_format_map.patch
keywords: patch
messages: 148096
nosy: akira
priority: normal
severity: normal
status: open
title: fix ''.format_map test
versions: Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file23747/correct-assertions-in-test_format_map.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13450>
_______________________________________


More information about the Python-bugs-list mailing list