tests.size.operations_test module
Tests for operations on Size objects.
-
class tests.size.operations_test.AdditionTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test addition.
-
testAddition(s1=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)))), s2=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)))))
Test addition.
-
testExceptions()
Any non-size other raises an exception.
-
class tests.size.operations_test.DivmodTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test divmod.
-
testDivmodWithNumber(s1=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)))), s2=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)))
Test divmod with a number.
-
testDivmodWithSize(s1=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)))), s2=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 != Size(0))))
Test divmod with a size.
-
testExceptions()
Test that exceptions are thrown.
-
class tests.size.operations_test.FloordivTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test floordiv.
-
testExceptions()
Test that exceptions are thrown.
-
testFloordivWithNumber(s1=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)))), s2=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)))
Test floordiv with a number.
-
testFloordivWithSize(s1=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)))), s2=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 != Size(0))))
Test floordiv with a size.
-
class tests.size.operations_test.ModTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test mod.
-
testExceptions()
Test that exceptions are thrown.
-
testModWithNumber(s1=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)))), s2=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: x != 0)))
Test mod with a number.
-
testModWithSize(s1=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)))), s2=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 != Size(0))))
Test mod with a size.
-
class tests.size.operations_test.MultiplicationTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test multiplication.
-
testExceptions()
Size others are unrepresentable.
-
testMultiplication(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)))), n=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite())))
Test multiplication.
-
class tests.size.operations_test.RdivmodTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rdivmod.
-
testExceptions()
Test that exceptions are thrown.
-
testRdivmodWithSize(s1=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 != Size(0))), s2=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)))))
Test divmod with a size.
-
class tests.size.operations_test.RfloordivTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rfloordiv.
-
testExceptions()
Test that exceptions are thrown.
-
testRfloordivWithSize(s1=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 != Size(0))), s2=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)))))
Test floordiv with a size.
-
class tests.size.operations_test.RmodTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rmod.
-
testExceptions()
Test that exceptions are thrown.
-
testRmodWithSize(s1=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 != Size(0))), s2=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)))))
Test rmod with a size.
-
class tests.size.operations_test.RsubTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rsub.
-
testExceptions()
Any non-size other raises an exception.
-
testRsub(s1=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)))), s2=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)))))
Test __rsub__.
-
class tests.size.operations_test.RtruedivTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test rtruediv.
-
testExceptions()
Test that exceptions are thrown.
-
testTruedivWithSize(s1=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 != Size(0))), s2=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)))))
Test truediv with a size.
-
class tests.size.operations_test.SubtractionTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test subtraction.
-
testExceptions()
Any non-size other raises an exception.
-
testSubtraction(s1=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)))), s2=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)))))
Test subtraction.
-
class tests.size.operations_test.TruedivTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test truediv.
-
testExceptions()
Test that exceptions are thrown.
-
testTruedivWithNumber(s1=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)))), s2=HypothesisProvided(value=integers() | fractions() | decimals().filter(lambda x: x.is_finite()).filter(lambda x: <unknown>)))
Test truediv with a number.
-
testTruedivWithSize(s1=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)))), s2=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 != Size(0))))
Test truediv with a size.
-
class tests.size.operations_test.UnaryOperatorsTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test unary operators.
-
testAbs(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)))))
Test absolute value.
-
testHash(s1=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)))), s2=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)))))
Test that hash has the necessary property for hash table lookup.
-
testNeg(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)))))
Test negation.
-
testPos(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)))))
Test positive.
-
class tests.size.operations_test.UtilityMethodsTestCase(methodName='runTest')
Bases: unittest.case.TestCase
Test operator methods and other methods with an ‘_’.
-
testBinaryOperatorsBoolean()
Test binary operators with a boolean result.
Test binary operators with a possible Size result.
-
testOtherMethods()
Test miscellaneous non-operator methods.
-
testUnaryOperators()
Test unary operators.