almost-0.1.dev
توضیحات
A helper to compare two numbers generously
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | almost-0.1.dev |
| نام | almost |
| نسخه کتابخانه | 0.1.dev |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Heungsub Lee |
| ایمیل نویسنده | sub@subl.ee |
| آدرس صفحه اصلی | http://github.com/sublee/almost |
| آدرس اینترنتی | https://pypi.org/project/almost/ |
| مجوز | BSD |
Almost
~~~~~~
A helper for approximate comparison.
::
from almost import almost
def test_repeating_decimal():
assert almost(1 / 3.) == 0.333
assert almost(1 / 6.) == 0.167
assert almost(3227 / 555., precision=6) == 5.814414
def test_irrational_number():
import math
assert almost(math.pi) == 3.142
assert almost(math.sqrt(2)) == 1.414
def test_random_text():
import random
def gen_text_with_prefix(prefix):
return prefix + str(random.random())[:-5]
assert almost(gen_text_with_prefix('@')) == '@...'
Links
`````
* `GitHub repository <http://github.com/sublee/almost>`_
* `development version
<http://github.com/sublee/almost/zipball/master#egg=almost-dev>`_
نحوه نصب
نصب پکیج whl almost-0.1.dev:
pip install almost-0.1.dev.whl
نصب پکیج tar.gz almost-0.1.dev:
pip install almost-0.1.dev.tar.gz