def test_waiter_help_documentation(self): waiter_name = 'WaiterName' waiter = create_waiter_with_client(waiter_name, self.waiter_model, self.client) with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: help(waiter.wait) content = mock_stdout.getvalue() lines = [ (' Polls :py:meth:`MyService.Client.foo` every 1 ' 'seconds until a successful state is reached. An error ' 'is returned after 1 failed checks.'), ' **Request Syntax** ', ' ::', ' waiter.wait(', " bar='string'", ' )', ' :type bar: string', ' :param bar: Documents bar', ' :returns: None', ] for line in lines: self.assertIn(line, content)
def test_file(self): body = six.StringIO() params = {'Body': body} handlers.convert_body_to_file_like_object(params) self.assertEqual(params['Body'], body)
def test_attribute_help(self): with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: help(self.resource.Sample('id').__class__.foo) attribute_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( [' - *(string) --* Documents Foo'], attribute_docstring)