diff options
author | Jonathan Wheeler <jonathan.m.wheeler@gmail.com> | 2018-07-19 17:34:54 -0700 |
---|---|---|
committer | Jonathan Wheeler <jonathan.m.wheeler@gmail.com> | 2018-07-19 17:35:27 -0700 |
commit | ec47d77cda81639d9457d3994c0ec23720f52f36 (patch) | |
tree | 8808df1bee6d740050e16640b2f2164781bb2023 /docs/wrapping.rst | |
parent | ba5cc0e76243c3e1e2b82999a71425ce3c6f3c1e (diff) | |
download | pint-ec47d77cda81639d9457d3994c0ec23720f52f36.tar.gz |
Added, documented, and tested new Quantity.check function
Diffstat (limited to 'docs/wrapping.rst')
-rw-r--r-- | docs/wrapping.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/wrapping.rst b/docs/wrapping.rst index dd9a39f..6ce6411 100644 --- a/docs/wrapping.rst +++ b/docs/wrapping.rst @@ -246,3 +246,12 @@ In the decorator format: ... def pendulum_period(length): ... return 2*math.pi*math.sqrt(length/G) +If you just want to check the dimensionality of a quantity, you can do so with the built-in 'check' function. + +.. doctest:: + + >>> distance = 1 * ureg.m + >>> distance.check('[length]') + True + >>> distance.check('[time]') + False |