@@ -621,6 +621,38 @@ def test_bucket_list_blobs_hierarchy_w_include_trailing_delimiter(
621
621
assert iterator .prefixes == expected_prefixes
622
622
623
623
624
+ @_helpers .retry_failures
625
+ def test_bucket_list_blobs_w_match_glob (
626
+ storage_client ,
627
+ buckets_to_delete ,
628
+ blobs_to_delete ,
629
+ ):
630
+ bucket_name = _helpers .unique_name ("w-matchglob" )
631
+ bucket = _helpers .retry_429_503 (storage_client .create_bucket )(bucket_name )
632
+ buckets_to_delete .append (bucket )
633
+
634
+ payload = b"helloworld"
635
+ blob_names = ["foo/bar" , "foo/baz" , "foo/foobar" , "foobar" ]
636
+ for name in blob_names :
637
+ blob = bucket .blob (name )
638
+ blob .upload_from_string (payload )
639
+ blobs_to_delete .append (blob )
640
+
641
+ match_glob_results = {
642
+ "foo*bar" : ["foobar" ],
643
+ "foo**bar" : ["foo/bar" , "foo/foobar" , "foobar" ],
644
+ "**/foobar" : ["foo/foobar" , "foobar" ],
645
+ "*/ba[rz]" : ["foo/bar" , "foo/baz" ],
646
+ "*/ba[!a-y]" : ["foo/baz" ],
647
+ "**/{foobar,baz}" : ["foo/baz" , "foo/foobar" , "foobar" ],
648
+ "foo/{foo*,*baz}" : ["foo/baz" , "foo/foobar" ],
649
+ }
650
+ for match_glob , expected_names in match_glob_results .items ():
651
+ blob_iter = bucket .list_blobs (match_glob = match_glob )
652
+ blobs = list (blob_iter )
653
+ assert [blob .name for blob in blobs ] == expected_names
654
+
655
+
624
656
def test_bucket_w_retention_period (
625
657
storage_client ,
626
658
buckets_to_delete ,
0 commit comments