Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed doctests #8

Merged
merged 4 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover
.pytest_cache/

# Translations
*.mo
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
language: python
python:
# We don't actually use the Travis Python, but this keeps it organized.
- "2.7"
- "3.4"
- "3.5"
- "3.6"
install:
- pip install coveralls
- pip install coveralls pytest
- python setup.py install

script:
- coverage run --source=docrep setup.py pytest
- pytest docrep --doctest-modules

after_success:
coveralls
16 changes: 10 additions & 6 deletions docrep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ def safe_modulo(s, meta, checked='', print_warning=True, stacklevel=2):

>>> from docrep import safe_modulo
>>> s = "That's %(one)s string %(with)s missing 'with' and %s key"
>>> s % {'one': 1}
# raises KeyError because of missing 'with'
>>> s % {'one': 1, 'with': 2}
# raises TypeError because of '%s'
>>> s % {'one': 1} # raises KeyError because of missing 'with'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'with'
>>> s % {'one': 1, 'with': 2} # raises TypeError because of '%s'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string
>>> safe_modulo(s, {'one': 1})
"That's 1 string %(with)s missing 'with' and %s key"
"""
Expand Down Expand Up @@ -164,14 +168,14 @@ class DocstringProcessor(object):
>>> print(second_test.__doc__)
My second function where I want to use the docstring from
above

<BLANKLINE>
Parameters
----------
a: int, optional
A dummy parameter description
b: int, optional
A second dummy parameter

<BLANKLINE>
Examples
--------
Some dummy example doc
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def readme():
install_requires=[
'six',
],
data_files = [("", ["LICENSE"])],
data_files=[("", ["LICENSE"])],
setup_requires=pytest_runner,
tests_require=['pytest'],
zip_safe=False)