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

Method test_get

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

Source from the content-addressed store, hash-verified

51 """
52
53 def test_get(self):
54 parser = config.IdleConfParser('')
55 parser.read_string(self.config)
56 eq = self.assertEqual
57
58 # Test with type argument.
59 self.assertIs(parser.Get('one', 'one', type='bool'), False)
60 self.assertIs(parser.Get('one', 'two', type='bool'), True)
61 eq(parser.Get('one', 'three', type='int'), 10)
62 eq(parser.Get('two', 'one'), 'a string')
63 self.assertIs(parser.Get('two', 'two', type='bool'), True)
64 self.assertIs(parser.Get('two', 'three', type='bool'), False)
65
66 # Test without type should fallback to string.
67 eq(parser.Get('two', 'two'), 'true')
68 eq(parser.Get('two', 'three'), 'false')
69
70 # If option not exist, should return None, or default.
71 self.assertIsNone(parser.Get('not', 'exist'))
72 eq(parser.Get('not', 'exist', default='DEFAULT'), 'DEFAULT')
73
74 def test_get_option_list(self):
75 parser = config.IdleConfParser('')

Callers

nothing calls this directly

Calls 5

GetMethod · 0.95
eqFunction · 0.85
read_stringMethod · 0.80
assertIsNoneMethod · 0.80
assertIsMethod · 0.45

Tested by

no test coverage detected