def test_close(self): # preparation writer = self._mock_writer() output.close() writer.close.assert_called_once_with()