Metadata-Version: 2.2
Name: almost
Version: 0.1.5
Summary: A helper to compare two numbers generously
Home-page: http://github.com/sublee/almost
Author: Heungsub Lee
Author-email: sub@subl.ee
License: BSD
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: Jython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
Requires-Dist: distribute
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: platform
Dynamic: requires-dist
Dynamic: summary


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>`_

