forked from awslabs/s3-connector-for-pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update comments and address PR review
- Loading branch information
dnnanuti
committed
Mar 21, 2024
1 parent
c85a0b9
commit c1b809d
Showing
4 changed files
with
24 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# // SPDX-License-Identifier: BSD | ||
from hypothesis import given | ||
from hypothesis import given, example | ||
from hypothesis.strategies import integers, floats | ||
|
||
from s3torchconnector import S3ClientConfig | ||
from .test_s3_client import MiB, GiB | ||
|
||
|
||
def test_default(): | ||
config = S3ClientConfig() | ||
assert config is not None | ||
assert config.part_size == 8 * 1024 * 1024 | ||
assert abs(config.throughput_target_gbps - 10.0) < 1e-9 | ||
assert config.part_size == 8 * MiB | ||
assert config.throughput_target_gbps == 10.0 | ||
|
||
|
||
@given(part_size=integers(min_value=1, max_value=1e12)) | ||
@given(part_size=integers(min_value=5 * MiB, max_value=5 * GiB)) | ||
def test_part_size_setup(part_size: int): | ||
config = S3ClientConfig(part_size=part_size) | ||
assert config is not None | ||
assert config.part_size == part_size | ||
assert abs(config.throughput_target_gbps - 10.0) < 1e-9 | ||
assert config.throughput_target_gbps == 10.0 | ||
|
||
|
||
@given(throughput_target_gbps=floats(min_value=1.0, max_value=100.0)) | ||
def test_throughput_target_gbps_setup(throughput_target_gbps: float): | ||
config = S3ClientConfig(throughput_target_gbps=throughput_target_gbps) | ||
assert config is not None | ||
assert config.part_size == 8 * 1024 * 1024 | ||
assert abs(config.throughput_target_gbps - throughput_target_gbps) < 1e-9 | ||
assert config.throughput_target_gbps == throughput_target_gbps | ||
|
||
|
||
@given( | ||
part_size=integers(min_value=1, max_value=1e12), | ||
part_size=integers(min_value=5 * MiB, max_value=5 * GiB), | ||
throughput_target_gbps=floats(min_value=1.0, max_value=100.0), | ||
) | ||
@example(part_size=5 * MiB, throughput_target_gbps=10.0) | ||
@example(part_size=5 * GiB, throughput_target_gbps=15.0) | ||
def test_custom_setup(part_size: int, throughput_target_gbps: float): | ||
config = S3ClientConfig( | ||
part_size=part_size, throughput_target_gbps=throughput_target_gbps | ||
) | ||
assert config is not None | ||
assert config.part_size == part_size | ||
assert abs(config.throughput_target_gbps - throughput_target_gbps) < 1e-9 | ||
assert config.throughput_target_gbps == throughput_target_gbps |