Added doctest to testsuite

This commit is contained in:
Hernan Grecco 2016-02-14 03:19:00 -03:00
parent 1c6897489d
commit ab6b888cdf
5 changed files with 12 additions and 15 deletions

View File

@ -5,13 +5,9 @@ Installation
Pint has no dependencies except Python_ itself. In runs on Python 2.6 and 3.0+.
You can install it using pip_::
You can install it (or upgrade to the latest version) using pip_::
$ pip install pint
or using easy_install_::
$ easy_install pint
$ pip install -U pint
That's all! You can check that Pint is correctly installed by starting up python, and importing pint:
@ -20,10 +16,6 @@ That's all! You can check that Pint is correctly installed by starting up python
>>> import pint # doctest: +SKIP
>>> pint.__version__ # doctest: +SKIP
.. testoutput::
|version|
.. note:: If you have an old system installation of Python and you don't want to
mess with it, you can try `Anaconda CE`_. It is a free Python distribution by
Continuum Analytics that includes many scientific packages.

View File

@ -54,7 +54,6 @@ is different).
>>> print(increase.to(ureg.delta_degF))
22.14 delta_degF
..
Subtraction of two temperatures given in offset units yields a *delta* unit:
.. doctest::

View File

@ -26,7 +26,7 @@ The easiest way to do this is by converting the quantity to a string:
24.2 year
Remember that you can easily control the number of digits in the representation
as shown in `String formatting`_.
as shown in :ref:`sec-string-formatting`.
You dump/store/transmit the content of serialized ('24.2 year'). When you want
to recover it in another process/machine, you just:

View File

@ -191,10 +191,12 @@ This enables you to build a simple unit converter in 3 lines:
.. note:: Since version 0.7, Pint **does not** uses eval_ under the hood.
This change removes the `serious security problem`_ that the system is
This change removes the `serious security problems`_ that the system is
exposed when parsing information from untrusted sources.
.. _sec-string-formatting:
String formatting
-----------------

View File

@ -3,8 +3,10 @@
from __future__ import division, unicode_literals, print_function, absolute_import
import doctest
import os
import logging
import os
import sys
from contextlib import contextmanager
from pint.compat import ndarray, unittest, np
@ -120,7 +122,9 @@ def testsuite():
"""A testsuite that has all the pint tests.
"""
suite = unittest.TestLoader().discover(os.path.dirname(__file__))
#add_docs(suite)
from pint.compat import HAS_NUMPY, HAS_UNCERTAINTIES
if HAS_NUMPY and HAS_UNCERTAINTIES and sys.version_info[0:2] == (3, 5):
add_docs(suite)
return suite