I have a source code that opens a csv file and sets up a header to value association. The source code is given below:
def ParseCsvFile(source): \"\"\"Pa
@mock.patch decorator (2.7 example)
This is now much easier:
import your_script.py import __builtin__ import mock @mock.patch("__builtin__.open") def test_example(self, mock_open): your_script.your_method() self.assertEqual(mock_open.call_count, 1)