instead of patching sys.stdout, can you patch word_counter.VIMAP_RUNNER.output_result, and then do something like,

((value,), _), = output_result_mock.call_args_list
T.assert_equal(12, value)?