比较两个数字的助手
项目描述
近似比较的助手
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('@')) == '@...'
链接
项目详情
关闭
almost-0.1.5.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | e192af9fb078b0276d001bfb52958511aef703a716e5b63678535a59ad560f5b |
|
MD5 | 2b0c0f576341622d7dd18d32a6c1d402 |
|
BLAKE2b-256 | 3f8dc7ea8c685703a2f9c1ea4e7bae2826546322f1dfb0a798963e1672702dfb |