@@ -2169,25 +2169,25 @@ def test_get_default_model_with_warning_supported_regions_shows_no_warning(captu
21692169 """Test get_model_prefix_with_warning doesn't warn for supported region prefixes."""
21702170 BedrockModel ._get_default_model_with_warning ("us-west-2" )
21712171 BedrockModel ._get_default_model_with_warning ("eu-west-2" )
2172- assert len ( captured_warnings ) == 0
2172+ assert all ( "does not support" not in str ( w . message ) for w in captured_warnings )
21732173
21742174
21752175def test_get_default_model_for_supported_eu_region_returns_correct_model_id (captured_warnings ):
21762176 model_id = BedrockModel ._get_default_model_with_warning ("eu-west-1" )
21772177 assert model_id == "eu.anthropic.claude-sonnet-4-20250514-v1:0"
2178- assert len ( captured_warnings ) == 0
2178+ assert all ( "does not support" not in str ( w . message ) for w in captured_warnings )
21792179
21802180
21812181def test_get_default_model_for_supported_us_region_returns_correct_model_id (captured_warnings ):
21822182 model_id = BedrockModel ._get_default_model_with_warning ("us-east-1" )
21832183 assert model_id == "us.anthropic.claude-sonnet-4-20250514-v1:0"
2184- assert len ( captured_warnings ) == 0
2184+ assert all ( "does not support" not in str ( w . message ) for w in captured_warnings )
21852185
21862186
21872187def test_get_default_model_for_supported_gov_region_returns_correct_model_id (captured_warnings ):
21882188 model_id = BedrockModel ._get_default_model_with_warning ("us-gov-west-1" )
21892189 assert model_id == "us-gov.anthropic.claude-sonnet-4-20250514-v1:0"
2190- assert len ( captured_warnings ) == 0
2190+ assert all ( "does not support" not in str ( w . message ) for w in captured_warnings )
21912191
21922192
21932193def test_get_model_prefix_for_ap_region_converts_to_apac_endpoint (captured_warnings ):
@@ -2199,9 +2199,10 @@ def test_get_model_prefix_for_ap_region_converts_to_apac_endpoint(captured_warni
21992199def test_get_default_model_with_warning_unsupported_region_warns (captured_warnings ):
22002200 """Test _get_default_model_with_warning warns for unsupported regions."""
22012201 BedrockModel ._get_default_model_with_warning ("ca-central-1" )
2202- assert len (captured_warnings ) == 1
2203- assert "This region ca-central-1 does not support" in str (captured_warnings [0 ].message )
2204- assert "our default inference endpoint" in str (captured_warnings [0 ].message )
2202+ region_warnings = [w for w in captured_warnings if "does not support" in str (w .message )]
2203+ assert len (region_warnings ) == 1
2204+ assert "This region ca-central-1 does not support" in str (region_warnings [0 ].message )
2205+ assert "our default inference endpoint" in str (region_warnings [0 ].message )
22052206
22062207
22072208def test_get_default_model_with_warning_no_warning_with_custom_model_id (captured_warnings ):
@@ -2217,8 +2218,9 @@ def test_init_with_unsupported_region_warns(session_cls, captured_warnings):
22172218 """Test BedrockModel initialization warns for unsupported regions."""
22182219 BedrockModel (region_name = "ca-central-1" )
22192220
2220- assert len (captured_warnings ) == 1
2221- assert "This region ca-central-1 does not support" in str (captured_warnings [0 ].message )
2221+ region_warnings = [w for w in captured_warnings if "does not support" in str (w .message )]
2222+ assert len (region_warnings ) == 1
2223+ assert "This region ca-central-1 does not support" in str (region_warnings [0 ].message )
22222224
22232225
22242226def test_init_with_unsupported_region_custom_model_no_warning (session_cls , captured_warnings ):
@@ -2237,7 +2239,7 @@ def test_no_override_uses_formatted_default_model_id(captured_warnings):
22372239 model_id = BedrockModel ._get_default_model_with_warning ("us-east-1" )
22382240 assert model_id == "us.anthropic.claude-sonnet-4-20250514-v1:0"
22392241 assert model_id != _DEFAULT_BEDROCK_MODEL_ID
2240- assert len ( captured_warnings ) == 0
2242+ assert all ( "does not support" not in str ( w . message ) for w in captured_warnings )
22412243
22422244
22432245def test_custom_model_id_not_overridden_by_region_formatting (session_cls ):
0 commit comments