twosigma / twosigma/marbles

Improve code example in marbles.core.TestCase docstring

Open
#117 5 comments 0 reactions 0 assignees View on GitHub
docs good first issue
Dominant language
Python
Stars
155
Forks
22
PR merge metrics
No merged PRs in 30d

Description

### Description
The `put` function in the code example provided in [`marbles.core.TestCase`](https://marbles.readthedocs.io/en/stable/core.html#marbles.core.TestCase) is indented strangely.

```python
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
1. this example doesn't demonstrate the advantage of capturing more information about the test author's intent

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.