def test_show_data_string_type(self):
     test_string = 'test string value'
     expected_printed_string = test_string + '\n'
     with patch('sys.stdout', new_callable=StringIO) as mock_print:
         show_data(test_string)
         real_printed_string = mock_print.getvalue()
     self.assertEqual(
         real_printed_string,
         expected_printed_string,
         'problem with printing out str type in the "show_data" method!'
     )
 def test_show_data_response_type(self):
     attrs = dict(text='text string', status_code='status code string')
     mock_response = Mock(
         __class__=Response,
         **attrs
     )
     expected_printed_string = '{status_code}\n{text}\n'.format(**attrs)
     with patch('sys.stdout', new_callable=StringIO) as mock_print:
         show_data(mock_response)
         real_printed_string = mock_print.getvalue()
     self.assertEqual(
         expected_printed_string,
         real_printed_string,
         'unexpected set of print() calls in the "show_data" method!'
     )