tests.util_test module

Test for utility functions.

class tests.util_test.FormatTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test formatting.

testExactness(n=HypothesisProvided(value=integers()), e=HypothesisProvided(value=integers(min_value=0)))

When max_places is not specified and the denominator of the value is a power of 10 the string result is exact.

testException()

Raises exception on bad input.

class tests.util_test.GetRepeatingFractionTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test get_repeating_fraction.

testExceptions()

Test exceptions.

class tests.util_test.LongDecimalDivisionTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test long decimal division.

testComplexRepeatingDecimal(divisor=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)), multiplier=HypothesisProvided(value=integers().filter(lambda x: x > 0)))

Should always end in .16666.....

testExact(divisor=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)), multiplier=HypothesisProvided(value=integers().filter(lambda x: x > 0)))

A divisor that divides the dividend has no decimal part.

testException()

Test exceptions.

testMoreComplexRepeatingDecimal(divisor=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)), multiplier=HypothesisProvided(value=integers().filter(lambda x: x > 0)))

Should always end in .142857142857....

testNonRepeatingDecimal(divisor=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)), multiplier=HypothesisProvided(value=integers().filter(lambda x: x > 0)))

Should always end in .5.

testRepeatingDecimal(divisor=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)), multiplier=HypothesisProvided(value=integers().filter(lambda x: x > 0)))

Should always end in .33333.....

class tests.util_test.RoundingTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test rounding of fraction.

testExceptions()

Raises exception on bad input.

testRounding(i=HypothesisProvided(value=integers(min_value=1, max_value=9)))

Rounding various values according to various methods.

Previous topic

tests.errors_test module

Next topic

tests.utils module

This Page