Skip to content

Improve code example in marbles.core.TestCase docstring #117

@thejunglejane

Description

@thejunglejane

Description

The put function in the code example provided in marbles.core.TestCase is indented strangely.

import requests
import marbles.core


    def put(cls, endpoint, data=None):
        return Response(status_code=409,
                        reason=('The request could not be completed '
                                'due to a conflict with the current '
                                'state of the target resource.'))


class ResponseTestCase(marbles.core.TestCase):

    def test_create_resource(self):
        endpoint = 'http://example.com/api/v1/resource'
        data = {'id': 1, 'name': 'Little Bobby Tables'}

        res = requests.put(endpoint, data=data)
        self.assertEqual(
            res.status_code,
            201,
            note=res.reason

Intended audience

Users

Additional context

A better-motivated example would be appropriate here:

  1. tests shouldn't be hitting external services
  2. this example doesn't demonstrate the advantage of capturing more information about the test author's intent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions