MCPcopy Index your code
hub / github.com/python/cpython / test_query_errors

Method test_query_errors

Lib/test/test_configparser.py:566–581  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 10

get_errorMethod · 0.95
assertFalseMethod · 0.80
has_sectionMethod · 0.80
newconfigMethod · 0.45
assertEqualMethod · 0.45
sectionsMethod · 0.45
assertRaisesMethod · 0.45
optionsMethod · 0.45
setMethod · 0.45
add_sectionMethod · 0.45

Tested by

no test coverage detected