MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_parse_callbacks

Method test_parse_callbacks

python/python3/tornado/test/options_test.py:50–71  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.assertEqual(options.my_path, config_path)
49
50 def test_parse_callbacks(self):
51 options = OptionParser()
52 self.called = False
53
54 def callback():
55 self.called = True
56
57 options.add_parse_callback(callback)
58
59 # non-final parse doesn't run callbacks
60 options.parse_command_line(["main.py"], final=False)
61 self.assertFalse(self.called)
62
63 # final parse does
64 options.parse_command_line(["main.py"])
65 self.assertTrue(self.called)
66
67 # callbacks can be run more than once on the same options
68 # object if there are multiple final parses
69 self.called = False
70 options.parse_command_line(["main.py"])
71 self.assertTrue(self.called)
72
73 def test_help(self):
74 options = OptionParser()

Callers

nothing calls this directly

Calls 3

add_parse_callbackMethod · 0.95
parse_command_lineMethod · 0.95
OptionParserClass · 0.90

Tested by

no test coverage detected