<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
</head>
<body>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
I am having a problem with the interaction of Mock and another library called sunburnt.
<br>
<br>
Here is the section of my code:<br>
<br>
<font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt">#These are the criteria that will go on every query - Also not the &quot;|&quot;, this is what is causing the problem.<br>
cm_query = solr.Q(solr.Q(model=&quot;value1&quot;) \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | solr.Q(model=&quot;value2&quot;))<br>
....<br>
#search_options are the user entered options I am then filtering by cm_query<br>
solr.query(**search_opts).filter(cm_query).sort_by('-created')</span></font><br>
<br>
The above works fine but when I try to test it with mock I get the error:<br>
Traceback (most recent call last):<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keep/../keep/common/tests.py&quot;, line 216, in test_search<br>
&nbsp;&nbsp;&nbsp; response = self.client.get(search_url)<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keepEnv/lib/python2.6/site-packages/django/test/client.py&quot;, line 445, in get<br>
&nbsp;&nbsp;&nbsp; response = super(Client, self).get(path, data=data, **extra)<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keepEnv/lib/python2.6/site-packages/django/test/client.py&quot;, line 229, in get<br>
&nbsp;&nbsp;&nbsp; return self.request(**r)<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keepEnv/lib/python2.6/site-packages/django/core/handlers/base.py&quot;, line 111, in get_response<br>
&nbsp;&nbsp;&nbsp; response = callback(request, *callback_args, **callback_kwargs)<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keepEnv/lib/python2.6/site-packages/django/contrib/auth/decorators.py&quot;, line 23, in _wrapped_view<br>
&nbsp;&nbsp;&nbsp; return view_func(request, *args, **kwargs)<br>
&nbsp; File &quot;/home/athom09/Projects/keep/keep/../keep/common/views.py&quot;, line 79, in search<br>
&nbsp;&nbsp;&nbsp; | solr.Q(content_model=AudioObject.AUDIO_CONTENT_MODEL))<br>
TypeError: unsupported operand type(s) for |: 'Mock' and 'Mock'<br>
<br>
<br>
According to the the Sunburnt developer, the | operator&nbsp; is an alias for&nbsp; A.__or__(B).&nbsp; Is there something special I need to do to mock this correctly preferably using the | operator?
<br>
<br>
-Alex <br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This e-mail message (including any attachments) is for the sole use of<br>
the intended recipient(s) and may contain confidential and privileged<br>
information. If the reader of this message is not the intended<br>
recipient, you are hereby notified that any dissemination, distribution<br>
or copying of this message (including any attachments) is strictly<br>
prohibited.<br>
<br>
If you have received this message in error, please contact<br>
the sender by reply e-mail message and destroy all copies of the<br>
original message (including attachments).<br>
</font>
</body>
</html>