def test_calculate_part_size():
    assert 5*MB <= calculate_part_size(fileSize=3*MB,       partSize=None, min_part_size=5*MB, max_parts=10000) == 5*MB
    assert 5*MB <= calculate_part_size(fileSize=6*MB,       partSize=None, min_part_size=5*MB, max_parts=2) == 5*MB
    assert 5*MB <= calculate_part_size(fileSize=11*MB,      partSize=None, min_part_size=5*MB, max_parts=2) == 11*MB / 2.0
    assert 5*MB <= calculate_part_size(fileSize=100*MB,     partSize=None, min_part_size=5*MB, max_parts=2) >= (100*MB) / 2.0
    assert calculate_part_size(fileSize=11*MB+777,  partSize=None, min_part_size=5*MB, max_parts=2) >= (11*MB+777) / 2.0 <= 5*MB
    assert 5*MB <= calculate_part_size(fileSize=101*GB+777, partSize=None, min_part_size=5*MB, max_parts=10000) >= (101*GB+777) / 10000.0

    ## OK
    assert calculate_part_size(6*MB, partSize=10*MB, min_part_size=5*MB, max_parts=10000) == 10*MB

    ## partSize too small
    assert_raises(ValueError, calculate_part_size, fileSize=100*MB, partSize=1*MB, min_part_size=5*MB, max_parts=10000)

    ## too many parts
    assert_raises(ValueError, calculate_part_size, fileSize=21*MB, partSize=1*MB, min_part_size=1*MB, max_parts=20)
dataset/ETHPy150Open Sage-Bionetworks/synapsePythonClient/tests/unit/unit_test_multipart_upload.py/test_calculate_part_size/swapped operands of `<=`