Add full_name property to Contact and corresponding tests

This commit is contained in:
m-xim 2026-01-31 13:56:22 +03:00
parent ec7da0f678
commit fb9a48251b
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,20 @@
import pytest
from aiogram.types import Contact
class TestContact:
@pytest.mark.parametrize(
"first,last,result",
[
["User", None, "User"],
["", None, ""],
[" ", None, " "],
["User", "Name", "User Name"],
["User", " ", "User "],
[" ", " ", " "],
],
)
def test_full_name(self, first: str, last: str, result: bool):
contact = Contact(phone_number="911", first_name=first, last_name=last)
assert contact.full_name == result