Skip to content

Commit 7178add

Browse files
authored
Merge branch 'main' into add-python-314
2 parents d8a1387 + 02de5b6 commit 7178add

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/test_settings.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,10 @@ def test_protected_namespace_defaults():
23532353
# pydantic default
23542354
with pytest.warns(
23552355
UserWarning,
2356-
match='Field "model_dump_prefixed_field" in Model has conflict with protected namespace "model_dump"',
2356+
match=(
2357+
'Field "model_dump_prefixed_field" in Model has conflict with protected namespace "model_dump"|'
2358+
r"Field 'model_dump_prefixed_field' in 'Model' conflicts with protected namespace 'model_dump'\..*"
2359+
),
23572360
):
23582361

23592362
class Model(BaseSettings):
@@ -2362,18 +2365,21 @@ class Model(BaseSettings):
23622365
# pydantic-settings default
23632366
with pytest.warns(
23642367
UserWarning,
2365-
match='Field "settings_customise_sources_prefixed_field" in Model1 has conflict with protected namespace "settings_customise_sources"',
2368+
match=(
2369+
'Field "settings_customise_sources_prefixed_field" in Model1 has conflict with protected namespace "settings_customise_sources"|'
2370+
r"Field 'settings_customise_sources_prefixed_field' in 'Model1' conflicts with protected namespace 'settings_customise_sources'\..*"
2371+
),
23662372
):
23672373

23682374
class Model1(BaseSettings):
23692375
settings_customise_sources_prefixed_field: str
23702376

23712377
with pytest.raises(
2372-
NameError,
2378+
(NameError, ValueError),
23732379
match=(
2374-
'Field "settings_customise_sources" conflicts with member <bound method '
2375-
"BaseSettings.settings_customise_sources of <class 'pydantic_settings.main.BaseSettings'>> "
2376-
'of protected namespace "settings_customise_sources".'
2380+
r'Field (["\'])settings_customise_sources\1 conflicts with member <bound method '
2381+
r"BaseSettings\.settings_customise_sources of <class 'pydantic_settings\.main\.BaseSettings'>> "
2382+
r'of protected namespace \1settings_customise_sources\1\.'
23772383
),
23782384
):
23792385

0 commit comments

Comments
 (0)