(self)
| 566 | ) |
| 567 | |
| 568 | def test_main(self): |
| 569 | for command, expected_url, expected_new_win in [ |
| 570 | # No optional arguments |
| 571 | ("https://example.com", "https://example.com", 0), |
| 572 | # Each optional argument |
| 573 | ("https://example.com -n", "https://example.com", 1), |
| 574 | ("-n https://example.com", "https://example.com", 1), |
| 575 | ("https://example.com -t", "https://example.com", 2), |
| 576 | ("-t https://example.com", "https://example.com", 2), |
| 577 | # Long form |
| 578 | ("https://example.com --new-window", "https://example.com", 1), |
| 579 | ("--new-window https://example.com", "https://example.com", 1), |
| 580 | ("https://example.com --new-tab", "https://example.com", 2), |
| 581 | ("--new-tab https://example.com", "https://example.com", 2), |
| 582 | ]: |
| 583 | with ( |
| 584 | mock.patch("webbrowser.open", return_value=None) as mock_open, |
| 585 | mock.patch("builtins.print", return_value=None), |
| 586 | ): |
| 587 | webbrowser.main(shlex.split(command)) |
| 588 | mock_open.assert_called_once_with(expected_url, expected_new_win) |
| 589 | |
| 590 | |
| 591 | if __name__ == '__main__': |
no test coverage detected