title: AttributeError: None does not have the attribute 'print'
body: <p>So I am practicing some unit test and I am trying to check for an output that is within a For Loop. Here is my run code</p>
  
  <pre><code>def main():
  
    for i in range(100):
      print("Argh!")
  </code></pre>
  
  <p>Pretty basic, now here is my test code.</p>
  
  <pre><code>import unittest
  from unittest import mock  # possibly "from unittest import mock" depending on version.
  from RunFile import main
  
  class TestMain(unittest.TestCase):
      def test_main(self):
          with mock.patch.object(main(), 'print') as mock_print:
              main()
          expected_calls = [mock.call('Argh!') for _ in range(100)]
          mock_print.assert_has_calls(expected_calls)
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>Here is the error message I get back. I'm not to sure how to resolve this.
  UPDATED: Here is the full trace back</p>
  
  <pre><code>======================================================================
  ERROR: test_main (__main__.TestMain)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "C:/Users/jsalce/Documents/Testsuites/IfStatements/Testsuite.py", line 9, in test_main
      with mock.patch.object(RunFile, 'print') as mock_print:
    File "C:\Python33\lib\unittest\mock.py", line 1148, in __enter__
      original, local = self.get_original()
    File "C:\Python33\lib\unittest\mock.py", line 1122, in get_original
      "%s does not have the attribute %r" % (target, name)
  AttributeError: &lt;module 'RunFile' from      'C:\\Users\\jsalce\\Documents\\Testsuites\\IfStatements\\RunFile.py'&gt; does not have the attribute 'print'
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.001s
  
  FAILED (errors=1)
  </code></pre>
  
  <p>Thank you all in advance!</p>