Created
August 11, 2013 13:04
-
-
Save cgallemore/6204800 to your computer and use it in GitHub Desktop.
mock raw_input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import mock | |
In [2]: mock_input = mock.MagicMock() | |
In [3]: with mock.patch('__builtin__.raw_input', mock_input): | |
...: mock_input.return_value = 'foobar' | |
...: foo = raw_input() | |
...: | |
In [4]: foo | |
Out[4]: 'foobar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment