tests.test_nats module

Test for integer conversions.

class tests.test_nats.NatsTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for ints.

testCarryIn(strategy=HypothesisProvided(value=integers(min_value=2).flatmap(lambda n: strategies.tuples(build_nat(n, 64), strategies.integers(min_value=1, max_value=(n - 1)), strategies.just(n) ))))

Test carry_in.

Parameters:strategy – the strategy (tuple of value, carry, base)
testExceptions()

Test throwing exception.

testFromInt(value=HypothesisProvided(value=integers(min_value=0)), to_base=HypothesisProvided(value=integers(min_value=2)))

convert_to_int(convert_from_int(value, to_base), 10) == value No leading zeros in convert_from_int(value, to_base)

testFromOther(nat=HypothesisProvided(value=integers(min_value=2).flatmap(lambda n: strategies.tuples(build_nat(n, 64), strategies.just(n)))), to_base=HypothesisProvided(value=integers(min_value=2, max_value=64)))

Test roundtrip from number in arbitrary base.

Previous topic

tests.test_division module

Next topic

tests.test_radix module

This Page