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

Method test_set_option

Lib/idlelib/idle_test/test_config.py:103–117  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

101 return config.IdleUserConfParser(path)
102
103 def test_set_option(self):
104 parser = self.new_parser()
105 parser.add_section('Foo')
106 # Setting new option in existing section should return True.
107 self.assertTrue(parser.SetOption('Foo', 'bar', 'true'))
108 # Setting existing option with same value should return False.
109 self.assertFalse(parser.SetOption('Foo', 'bar', 'true'))
110 # Setting exiting option with new value should return True.
111 self.assertTrue(parser.SetOption('Foo', 'bar', 'false'))
112 self.assertEqual(parser.Get('Foo', 'bar'), 'false')
113
114 # Setting option in new section should create section and return True.
115 self.assertTrue(parser.SetOption('Bar', 'bar', 'true'))
116 self.assertCountEqual(parser.sections(), ['Bar', 'Foo'])
117 self.assertEqual(parser.Get('Bar', 'bar'), 'true')
118
119 def test_remove_option(self):
120 parser = self.new_parser()

Callers

nothing calls this directly

Calls 9

new_parserMethod · 0.95
assertTrueMethod · 0.80
assertFalseMethod · 0.80
GetMethod · 0.80
assertCountEqualMethod · 0.80
add_sectionMethod · 0.45
SetOptionMethod · 0.45
assertEqualMethod · 0.45
sectionsMethod · 0.45

Tested by

no test coverage detected