You want to write unittest-cases for a function like that:
unittest
def test_me(a): for b in c: print do_something(a,b)
At firs
In Python 3 it's easy to use unittest.mock on the builtin print function:
unittest.mock
print
from unittest.mock import patch, call @patch('builtins.print') def test_print(mocked_print): print('foo') print() assert mocked_print.mock_calls == [call('foo'), call()]