(self)
| 2211 | self.assertEqual(output.getvalue(), '[section]\n\n') |
| 2212 | |
| 2213 | def test_add_section(self): |
| 2214 | cfg = configparser.ConfigParser(allow_unnamed_section=True) |
| 2215 | cfg.add_section(configparser.UNNAMED_SECTION) |
| 2216 | cfg.set(configparser.UNNAMED_SECTION, 'a', '1') |
| 2217 | self.assertEqual('1', cfg[configparser.UNNAMED_SECTION]['a']) |
| 2218 | output = io.StringIO() |
| 2219 | cfg.write(output) |
| 2220 | self.assertEqual(output.getvalue(), 'a = 1\n\n') |
| 2221 | |
| 2222 | cfg = configparser.ConfigParser(allow_unnamed_section=True) |
| 2223 | cfg[configparser.UNNAMED_SECTION] = {'a': '1'} |
| 2224 | self.assertEqual('1', cfg[configparser.UNNAMED_SECTION]['a']) |
| 2225 | output = io.StringIO() |
| 2226 | cfg.write(output) |
| 2227 | self.assertEqual(output.getvalue(), 'a = 1\n\n') |
| 2228 | |
| 2229 | def test_disabled_error(self): |
| 2230 | with self.assertRaises(configparser.MissingSectionHeaderError): |
nothing calls this directly
no test coverage detected