Skip to content

Commit 41dd763

Browse files
committed
fixes pylint
1 parent f366fc3 commit 41dd763

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/settings-library/tests/test__pydantic_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ class Settings(BaseSettings):
5656
@classmethod
5757
def parse_none(cls, v, info: ValidationInfo):
5858
# WARNING: In nullable fields, envs equal to null or none are parsed as None !!
59+
5960
if (
6061
info.field_name
61-
and is_nullable(cls.model_fields[info.field_name])
62+
and is_nullable(dict(cls.model_fields)[info.field_name])
6263
and isinstance(v, str)
6364
and v.lower() in ("null", "none")
6465
):

packages/settings-library/tests/test_ec2.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ def test_ec2_endpoint_invalid(monkeypatch: pytest.MonkeyPatch):
5353
with pytest.raises(ValidationError) as err_info:
5454
EC2Settings.create_from_envs()
5555

56-
assert err_info.value.errors()
57-
err_info.value.errors()[0]["loc"] == ("EC2_ENDPOINT")
58-
err_info.value.errors()[0]["type"] == "url_scheme"
56+
assert err_info.value.error_count() == 1
57+
error = err_info.value.errors()[0]
58+
59+
assert error["loc"] == ("EC2_ENDPOINT")
60+
assert error["type"] == "url_scheme"
5961

6062

6163
def test_ec2_endpoint_description():
62-
assert EC2Settings.model_fields["EC2_ACCESS_KEY_ID"].description is None
63-
assert EC2Settings.model_fields["EC2_ENDPOINT"].description is not None
64+
model_fields = dict(EC2Settings.model_fields)
65+
assert model_fields["EC2_ACCESS_KEY_ID"].description is None
66+
assert model_fields["EC2_ENDPOINT"].description is not None

0 commit comments

Comments
 (0)