Disclaimer: I have never used Mock.<br><br>Defining what &quot;|&quot; does means implementing one (or more, since there&#39;s a symmetrical __ror__ method, too) protocol methods, aka magic methods. That means you want the MagicMock class. <a href="http://www.voidspace.org.uk/python/mock/magicmock.html">http://www.voidspace.org.uk/python/mock/magicmock.html</a><br>

<br>cheers<br>lvh<br><br>