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

Method test_clear

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

Source from the content-addressed store, hash-verified

835 cf.popitem()
836
837 def test_clear(self):
838 cf = self.newconfig({"foo": "Bar"})
839 self.assertEqual(
840 cf.get(self.default_section, "Foo"), "Bar",
841 "could not locate option, expecting case-insensitive option names")
842 cf['zing'] = {'option1': 'value1', 'option2': 'value2'}
843 self.assertEqual(cf.sections(), ['zing'])
844 self.assertEqual(set(cf['zing'].keys()), {'option1', 'option2', 'foo'})
845 cf.clear()
846 self.assertEqual(set(cf.sections()), set())
847 self.assertEqual(set(cf[self.default_section].keys()), {'foo'})
848
849 def test_setitem(self):
850 cf = self.fromstring("""

Callers

nothing calls this directly

Calls 7

setFunction · 0.85
newconfigMethod · 0.45
assertEqualMethod · 0.45
getMethod · 0.45
sectionsMethod · 0.45
keysMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected