Debian Codegraph @

tests/test_coverup_83.py

raw symbols SCIP
1 # file scalene/scalene_parseargs.py:15-24
2 # lines [17, 19, 20, 23, 24]
3 # branches ['23->exit', '23->24']
4
5 import argparse
6 from unittest.mock import patch
7 import pytest
8
9 # Assuming the RichArgParser class is in a file named scalene_parseargs.py
10 from scalene.scalene_parseargs import RichArgParser
11
12
13 def test_rich_arg_parser_print_message(capsys):
14 with patch("rich.console.Console") as mock_console:
15 parser = RichArgParser()
16 parser._print_message("Test message")
17 mock_console.return_value.print.assert_called_once_with("Test message")
18
19 # Now test with message being None
20 parser._print_message(None)
21 mock_console.return_value.print.assert_called_once_with("Test message")
22
23 # Capture the output to ensure it's not printed to the actual console
24 captured = capsys.readouterr()
25 assert captured.out == ""
26 assert captured.err == ""
27
28
29 def test_rich_arg_parser_init():
30 with patch("rich.console.Console") as mock_console:
31 parser = RichArgParser()
32 mock_console.assert_called_once()
33 assert isinstance(parser, argparse.ArgumentParser)