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