tests.size.named_test module
Tests for named methods of Size objects.
-
class tests.size.named_test.ComponentsTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test components method.
-
testException()
Test exceptions.
-
testResults(s=HypothesisProvided(value=builds(<class 'bytesize._size.Size'>, integers())), min_val=HypothesisProvided(value=integers(min_value=1)), binary_units=HypothesisProvided(value=booleans()), exact_value=HypothesisProvided(value=booleans()), max_places=HypothesisProvided(value=integers().filter(lambda x: x >= 0 and x < 64)))
Test component results.
-
class tests.size.named_test.ConversionTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test conversion methods.
-
testException()
Test exceptions.
-
testPrecision(s=HypothesisProvided(value=builds(<class 'bytesize._size.Size'>, integers())), u=HypothesisProvided(value=none() | sampled_from((B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB, kB, MB, GB, TB, PB, EB, ZB, YB)) | builds(<class 'bytesize._size.Size'>, integers(min_value=1))))
Test precision of conversion.
-
class tests.size.named_test.RoundingTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rounding methods.
-
testExceptions()
Test raising exceptions when rounding.
-
testResults(s=HypothesisProvided(value=builds(<class 'bytesize._size.Size'>, integers() | fractions() | decimals().filter(lambda x: x.is_finite()) | builds(<type 'str'>, integers() | fractions() | decimals().filter(lambda x: x.is_finite())), sampled_from((B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB, kB, MB, GB, TB, PB, EB, ZB, YB)))), unit=HypothesisProvided(value=builds(<class 'bytesize._size.Size'>, integers() | fractions() | decimals().filter(lambda x: x.is_finite()) | builds(<type 'str'>, integers() | fractions() | decimals().filter(lambda x: x.is_finite())), sampled_from((B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB, kB, MB, GB, TB, PB, EB, ZB, YB))).filter(lambda x: x.magnitude >= 0) | sampled_from((B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB, kB, MB, GB, TB, PB, EB, ZB, YB))), rounding=HypothesisProvided(value=sampled_from((Round down., Round to nearest, down on a tie., Round to nearest, up on a tie., Round up.))))
Test roundTo results.