def test_kwargs_are_optional ( self ) : with patch ( "sys.exit" ) as mock_exit : cli = MicroCLITestCase . T ( "script_name f3" . split ( ) ) . run ( ) # kwargs are optional mock_exit . assert_called_with ( 4 )
unit test with mock and patch in python
kwarg values always have defaults
def test_kwargs_are_optional(self):
        """kwarg values always have defaults"""
        with patch("sys.exit") as mock_exit:
            cli = MicroCLITestCase.T("script_name f3".split()).run()
            # kwargs are optional
            mock_exit.assert_called_with(4)