Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for fixed-depth glob issue #179

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions tests/test_path_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_glob(s3_mock):
assert sorted(S3Path.from_uri('s3://test-bucket/').glob('docs/')) == [S3Path('/test-bucket/docs/')]


def test_glog_nested_folders_issue_no_115(s3_mock):
def test_glob_nested_folders_issue_no_115(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='my-bucket')
full_folder_tree = ''
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_glog_nested_folders_issue_no_115(s3_mock):
path /= S3Path(f'{folder}/')


def test_glog_nested_folders_issue_no_120(s3_mock):
def test_glob_nested_folders_issue_no_120(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='my-bucket')
object_summary = s3.ObjectSummary('my-bucket', 's3path-test/nested/further/test.txt')
Expand All @@ -164,12 +164,27 @@ def test_glog_nested_folders_issue_no_120(s3_mock):
assert list(path.glob("further/*")) == [S3Path('/my-bucket/s3path-test/nested/further/test.txt')]


def test_glob_nested_folders_issue_no_179(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='my-bucket')
example_paths = [
's3path/nested/further/andfurther/too_far_1.txt',
's3path/nested/further/andfurther/too_far_2.txt',
]
for example_path in example_paths:
object_summary = s3.ObjectSummary('my-bucket', f'{example_path}/test.txt')
object_summary.put(Body=b'test data')

path = S3Path.from_uri("s3://my-bucket/s3path/nested")
assert list(path.glob("*/*")) == [S3Path('/my-bucket/s3path/nested/further/andfurther')]


def test_glob_old_algo(s3_mock, enable_old_glob):
test_glob(s3_mock)


def test_glog_nested_folders_issue_no_115_old_algo(s3_mock, enable_old_glob):
test_glog_nested_folders_issue_no_115(s3_mock)
def test_glob_nested_folders_issue_no_115_old_algo(s3_mock, enable_old_glob):
test_glob_nested_folders_issue_no_115(s3_mock)


def test_glob_issue_160(s3_mock):
Expand Down
Loading