(self)
| 160 | self.assertCountEqual(parser.sections(), ['Foo']) |
| 161 | |
| 162 | def test_save(self): |
| 163 | with tempfile.TemporaryDirectory() as tdir: |
| 164 | path = os.path.join(tdir, 'test.cfg') |
| 165 | parser = self.new_parser(path) |
| 166 | parser.AddSection('Foo') |
| 167 | parser.SetOption('Foo', 'bar', 'true') |
| 168 | |
| 169 | # Should save to path when config is not empty. |
| 170 | self.assertFalse(os.path.exists(path)) |
| 171 | parser.Save() |
| 172 | self.assertTrue(os.path.exists(path)) |
| 173 | |
| 174 | # Should remove the file from disk when config is empty. |
| 175 | parser.remove_section('Foo') |
| 176 | parser.Save() |
| 177 | self.assertFalse(os.path.exists(path)) |
| 178 | |
| 179 | |
| 180 | class IdleConfTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected