title: Comparing integer to MagicMock not working inside unittest in python
body: <p>I have a class, which use a class variable to choose which logic to execute.</p>
  
  <pre><code>#in file1:
  
  class SomeHelper():
      def __init__(self):
          self.my_var = 0
  
  #in file2: 
  import file1
  class MyClass():
      ...
      ...
      def calculate():
          inst = file1.SomeHelper()
          if x &gt; inst.my_var:
             etc etc
  </code></pre>
  
  <p>I am writing a unit test and mocking SomeHelper() in another file:</p>
  
  <pre><code>from file 2 import MyClass
  # tried both
  @patch('file2.file1') OR @patch('file2.file1.SomeHelper')
  def test_calculate(self, mock_helper):
      mock_helper.my_var = 0
      to_test = MyClass.calculate()
  </code></pre>
  
  <p>And I get the following error: </p>
  
  <blockquote>
    <p>TypeError: '>' not supported between instances of 'MagicMock' and 'int'. </p>
  </blockquote>
  
  <p>I thought I defined <code>my_var</code> after I patched the module. </p>