(self)
| 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() |
nothing calls this directly
no test coverage detected