(self)
| 564 | return cm.exception |
| 565 | |
| 566 | def test_query_errors(self): |
| 567 | cf = self.newconfig() |
| 568 | self.assertEqual(cf.sections(), [], |
| 569 | "new ConfigParser should have no defined sections") |
| 570 | self.assertFalse(cf.has_section("Foo"), |
| 571 | "new ConfigParser should have no acknowledged " |
| 572 | "sections") |
| 573 | with self.assertRaises(configparser.NoSectionError): |
| 574 | cf.options("Foo") |
| 575 | with self.assertRaises(configparser.NoSectionError): |
| 576 | cf.set("foo", "bar", "value") |
| 577 | e = self.get_error(cf, configparser.NoSectionError, "foo", "bar") |
| 578 | self.assertEqual(e.args, ("foo",)) |
| 579 | cf.add_section("foo") |
| 580 | e = self.get_error(cf, configparser.NoOptionError, "foo", "bar") |
| 581 | self.assertEqual(e.args, ("bar", "foo")) |
| 582 | |
| 583 | def get_error(self, cf, exc, section, option): |
| 584 | try: |
nothing calls this directly
no test coverage detected