(self)
| 2163 | return cfg |
| 2164 | |
| 2165 | def test_no_first_section(self): |
| 2166 | cfg1 = self.fromstring(""" |
| 2167 | a = 1 |
| 2168 | b = 2 |
| 2169 | [sect1] |
| 2170 | c = 3 |
| 2171 | """) |
| 2172 | |
| 2173 | self.assertEqual(set([configparser.UNNAMED_SECTION, 'sect1']), set(cfg1.sections())) |
| 2174 | self.assertEqual('1', cfg1[configparser.UNNAMED_SECTION]['a']) |
| 2175 | self.assertEqual('2', cfg1[configparser.UNNAMED_SECTION]['b']) |
| 2176 | self.assertEqual('3', cfg1['sect1']['c']) |
| 2177 | |
| 2178 | output = io.StringIO() |
| 2179 | cfg1.write(output) |
| 2180 | cfg2 = self.fromstring(output.getvalue()) |
| 2181 | |
| 2182 | #self.assertEqual(set([configparser.UNNAMED_SECTION, 'sect1']), set(cfg2.sections())) |
| 2183 | self.assertEqual('1', cfg2[configparser.UNNAMED_SECTION]['a']) |
| 2184 | self.assertEqual('2', cfg2[configparser.UNNAMED_SECTION]['b']) |
| 2185 | self.assertEqual('3', cfg2['sect1']['c']) |
| 2186 | |
| 2187 | def test_no_section(self): |
| 2188 | cfg1 = self.fromstring(""" |
nothing calls this directly
no test coverage detected