Update deprecated pydantic fields access (#1309)

* chore: update deprecated pydantic fields access

* chore: add type hints for test

* fix: 3.9- type support
This commit is contained in:
Oleg A 2023-09-19 17:44:39 +03:00 committed by GitHub
parent 490381b57f
commit 8a77939d5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,5 @@
from typing import Dict
import pytest
from aiogram.types import ReplyKeyboardRemove
@ -10,12 +12,12 @@ class TestReplyKeyboardRemove:
def test_remove_keyboard_default_is_true(self):
assert (
ReplyKeyboardRemove.__fields__["remove_keyboard"].default is True
ReplyKeyboardRemove.model_fields["remove_keyboard"].default is True
), "Remove keyboard has incorrect default value!"
@pytest.mark.parametrize(
"kwargs,expected",
[[{}, True], [{"remove_keyboard": True}, True]],
)
def test_remove_keyboard_values(self, kwargs, expected):
def test_remove_keyboard_values(self, kwargs: Dict[str, bool], expected: bool):
assert ReplyKeyboardRemove(**kwargs).remove_keyboard is expected