A helper to compare two numbers generously
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
almost-0.1.1.tar.gz
(2.9 kB
view details)
File details
Details for the file almost-0.1.1.tar.gz
.
File metadata
- Download URL: almost-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acbed1c92af1d4f43edca43f404c0a0a9dab9a73ccfc954fef053a00ae97d123 |
|
MD5 | 1abf00b7a2335c40fb442ca98bcb01aa |
|
BLAKE2b-256 | 1ce19ca2561d0a277310608c47c1ef9772e538f9a81b096d6988d18898969d56 |