Skip to content

Instantly share code, notes, and snippets.

@stain
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stain/a98cba3cbe32a35a5f1e to your computer and use it in GitHub Desktop.
Save stain/a98cba3cbe32a35a5f1e to your computer and use it in GitHub Desktop.
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mock
>>> import select
>>> select.select([1], [1,2], [1])
([], [1, 2], [])
>>> sel = select.select
>>> select.select = mock.Mock()
>>> select.select([1], [1,2], [1])
<Mock name='mock()' id='140593171640528'>
>>> select.select.return_value
<Mock name='mock()' id='140593171640528'>
>>> select.select.return_value = "fred"
>>> select.select()
'fred'
>>> select.select.return_value = ([], [1,2], [])
>>> select.select([1], [1,2], [1])
([], [1, 2], [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment