(self)
| 61 | fmt.format(format_string="-{arg}-", arg='test') |
| 62 | |
| 63 | def test_auto_numbering(self): |
| 64 | fmt = string.Formatter() |
| 65 | self.assertEqual(fmt.format('foo{}{}', 'bar', 6), |
| 66 | 'foo{}{}'.format('bar', 6)) |
| 67 | self.assertEqual(fmt.format('foo{1}{num}{1}', None, 'bar', num=6), |
| 68 | 'foo{1}{num}{1}'.format(None, 'bar', num=6)) |
| 69 | self.assertEqual(fmt.format('{:^{}}', 'bar', 6), |
| 70 | '{:^{}}'.format('bar', 6)) |
| 71 | self.assertEqual(fmt.format('{:^{}} {}', 'bar', 6, 'X'), |
| 72 | '{:^{}} {}'.format('bar', 6, 'X')) |
| 73 | self.assertEqual(fmt.format('{:^{pad}}{}', 'foo', 'bar', pad=6), |
| 74 | '{:^{pad}}{}'.format('foo', 'bar', pad=6)) |
| 75 | |
| 76 | with self.assertRaises(ValueError): |
| 77 | fmt.format('foo{1}{}', 'bar', 6) |
| 78 | |
| 79 | with self.assertRaises(ValueError): |
| 80 | fmt.format('foo{}{1}', 'bar', 6) |
| 81 | |
| 82 | def test_conversion_specifiers(self): |
| 83 | fmt = string.Formatter() |
nothing calls this directly
no test coverage detected