@@ -873,6 +873,10 @@ async def test_url_segment_validation_errors() -> None:
873
873
with pytest .raises (ZEP8URLError , match = "Invalid adapter name" ):
874
874
URLSegment (adapter = "invalid@name" )
875
875
876
+ # Test invalid adapter name (starts with number)
877
+ with pytest .raises (ZEP8URLError , match = "Invalid adapter name" ):
878
+ URLSegment (adapter = "1abc" )
879
+
876
880
877
881
async def test_memory_adapter_error_conditions () -> None :
878
882
"""Test error conditions in MemoryAdapter."""
@@ -1073,7 +1077,17 @@ def test_url_segment_edge_cases() -> None:
1073
1077
"""Test URLSegment edge cases and validation."""
1074
1078
1075
1079
# Test adapter name validation with various valid names
1076
- valid_names = ["zip" , "memory" , "s3" , "test123" , "valid_name" , "valid-name" , "z" , "Z" , "1abc" ]
1080
+ valid_names = [
1081
+ "zip" ,
1082
+ "memory" ,
1083
+ "s3" ,
1084
+ "test123" ,
1085
+ "valid_name" ,
1086
+ "valid-name" ,
1087
+ "z" ,
1088
+ "Z" ,
1089
+ "s3+http" ,
1090
+ ]
1077
1091
for name in valid_names :
1078
1092
segment = URLSegment (adapter = name )
1079
1093
assert segment .adapter == name
@@ -1950,14 +1964,14 @@ async def test_s3_adapter_error_conditions() -> None:
1950
1964
# Skip if s3fs is not available
1951
1965
pytest .importorskip ("s3fs" , reason = "s3fs not available" )
1952
1966
1953
- # Test invalid URL parsing
1967
+ # Test unsupported URL format
1954
1968
segment = URLSegment (adapter = "s3" )
1955
- with pytest .raises (ValueError , match = "Invalid S3 URL format" ):
1956
- await S3Adapter .from_url_segment (segment , "s3 ://" )
1969
+ with pytest .raises (ValueError , match = "Unsupported S3 URL format" ):
1970
+ await S3Adapter .from_url_segment (segment , "invalid ://not-s3 " )
1957
1971
1958
- # Test empty bucket
1959
- with pytest .raises (ValueError , match = "Invalid S3 URL format" ):
1960
- await S3Adapter .from_url_segment (segment , "s3 :///key " )
1972
+ # Test invalid protocol
1973
+ with pytest .raises (ValueError , match = "Unsupported S3 URL format" ):
1974
+ await S3Adapter .from_url_segment (segment , "gs ://bucket/path " )
1961
1975
1962
1976
1963
1977
async def test_s3_http_adapter_url_parsing () -> None :
@@ -1967,7 +1981,7 @@ async def test_s3_http_adapter_url_parsing() -> None:
1967
1981
# Skip if s3fs is not available
1968
1982
pytest .importorskip ("s3fs" , reason = "s3fs not available" )
1969
1983
1970
- # Test S3HttpAdapter
1984
+ # Test S3HttpAdapter URL parsing (now that + is allowed in adapter names)
1971
1985
segment = URLSegment (adapter = "s3+http" )
1972
1986
# This should try to parse the custom endpoint
1973
1987
with contextlib .suppress (ImportError ):
@@ -1980,8 +1994,9 @@ async def test_s3_http_adapter_url_parsing() -> None:
1980
1994
await S3HttpsAdapter .from_url_segment (segment , "s3+https://custom.endpoint.com/bucket/key" )
1981
1995
1982
1996
# Test error condition - invalid custom endpoint URL
1983
- with pytest .raises (ValueError , match = "Invalid S3 custom endpoint URL format" ):
1984
- await S3HttpAdapter .from_url_segment (segment , "s3+http://" )
1997
+ http_segment = URLSegment (adapter = "s3+http" )
1998
+ with pytest .raises (ValueError , match = "Unsupported S3 URL format" ):
1999
+ await S3HttpAdapter .from_url_segment (http_segment , "invalid://not-s3-format" )
1985
2000
1986
2001
1987
2002
async def test_gc_adapter_missing_coverage () -> None :
0 commit comments