Repository: python-telegram-bot/python-telegram-bot

Issue:
Double check the API 6.0 update if `_id_attrs` should have been updated



Discussion:

Resolving patch:
diff --git a/telegram/_inline/inlinekeyboardbutton.py b/telegram/_inline/inlinekeyboardbutton.py
--- a/telegram/_inline/inlinekeyboardbutton.py
+++ b/telegram/_inline/inlinekeyboardbutton.py
@@ -35,8 +35,8 @@ class InlineKeyboardButton(TelegramObject):
 
     Objects of this class are comparable in terms of equality. Two objects of this class are
     considered equal, if their :attr:`text`, :attr:`url`, :attr:`login_url`, :attr:`callback_data`,
-    :attr:`switch_inline_query`, :attr:`switch_inline_query_current_chat`, :attr:`callback_game`
-    and :attr:`pay` are equal.
+    :attr:`switch_inline_query`, :attr:`switch_inline_query_current_chat`, :attr:`callback_game`,
+    :attr:`web_app` and :attr:`pay` are equal.
 
     Note:
         * You must use exactly one of the optional fields. Mind that :attr:`callback_game` is not
@@ -62,6 +62,10 @@ class InlineKeyboardButton(TelegramObject):
 
         * After Bot API 6.1, only ``HTTPS`` links will be allowed in :paramref:`login_url`.
 
+    .. versionchanged:: 20.0
+       :attr:`web_app` is considered as well when comparing objects of this type in terms of
+       equality.
+
     Args:
         text (:obj:`str`): Label text on the button.
         url (:obj:`str`, optional): HTTP or tg:// url to be opened when the button is pressed.
@@ -185,6 +189,7 @@ def _set_id_attrs(self) -> None:
             self.url,
             self.login_url,
             self.callback_data,
+            self.web_app,
             self.switch_inline_query,
             self.switch_inline_query_current_chat,
             self.callback_game,
diff --git a/telegram/_keyboardbutton.py b/telegram/_keyboardbutton.py
--- a/telegram/_keyboardbutton.py
+++ b/telegram/_keyboardbutton.py
@@ -35,8 +35,8 @@ class KeyboardButton(TelegramObject):
     used instead of this object to specify text of the button.
 
     Objects of this class are comparable in terms of equality. Two objects of this class are
-    considered equal, if their :attr:`text`, :attr:`request_contact`, :attr:`request_location` and
-    :attr:`request_poll` are equal.
+    considered equal, if their :attr:`text`, :attr:`request_contact`, :attr:`request_location`,
+    :attr:`request_poll` and :attr:`web_app` are equal.
 
     Note:
         * Optional fields are mutually exclusive.
@@ -47,6 +47,10 @@ class KeyboardButton(TelegramObject):
         * :attr:`web_app` option will only work in Telegram versions released after 16 April, 2022.
           Older clients will display unsupported message.
 
+    .. versionchanged:: 20.0
+       :attr:`web_app` is considered as well when comparing objects of this type in terms of
+       equality.
+
     Args:
         text (:obj:`str`): Text of the button. If none of the optional fields are used, it will be
             sent to the bot as a message when the button is pressed.
@@ -99,6 +103,7 @@ def __init__(
             self.request_contact,
             self.request_location,
             self.request_poll,
+            self.web_app,
         )
 
     @classmethod
diff --git a/telegram/_webhookinfo.py b/telegram/_webhookinfo.py
--- a/telegram/_webhookinfo.py
+++ b/telegram/_webhookinfo.py
@@ -36,7 +36,12 @@ class WebhookInfo(TelegramObject):
     Objects of this class are comparable in terms of equality. Two objects of this class are
     considered equal, if their :attr:`url`, :attr:`has_custom_certificate`,
     :attr:`pending_update_count`, :attr:`ip_address`, :attr:`last_error_date`,
-    :attr:`last_error_message`, :attr:`max_connections` and :attr:`allowed_updates` are equal.
+    :attr:`last_error_message`, :attr:`max_connections`, :attr:`allowed_updates` and
+    :attr:`last_synchronization_error_date` are equal.
+
+    .. versionchanged:: 20.0
+       :attr:`last_synchronization_error_date` is considered as well when comparing objects of
+       this type in terms of equality.
 
     Args:
         url (:obj:`str`): Webhook URL, may be empty if webhook is not set up.
@@ -121,6 +126,7 @@ def __init__(
             self.last_error_message,
             self.max_connections,
             self.allowed_updates,
+            self.last_synchronization_error_date,
         )
 
     @classmethod


Test patch:
diff --git a/tests/test_inlinekeyboardbutton.py b/tests/test_inlinekeyboardbutton.py
--- a/tests/test_inlinekeyboardbutton.py
+++ b/tests/test_inlinekeyboardbutton.py
@@ -130,7 +130,8 @@ def test_equality(self):
         c = InlineKeyboardButton("texts", callback_data="data")
         d = InlineKeyboardButton("text", callback_data="info")
         e = InlineKeyboardButton("text", url="http://google.com")
-        f = LoginUrl("http://google.com")
+        f = InlineKeyboardButton("text", web_app=WebAppInfo(url="https://ptb.org"))
+        g = LoginUrl("http://google.com")
 
         assert a == b
         assert hash(a) == hash(b)
@@ -147,6 +148,9 @@ def test_equality(self):
         assert a != f
         assert hash(a) != hash(f)
 
+        assert a != g
+        assert hash(a) != hash(g)
+
     @pytest.mark.parametrize("callback_data", ["foo", 1, ("da", "ta"), object()])
     def test_update_callback_data(self, callback_data):
         button = InlineKeyboardButton(text="test", callback_data="data")
diff --git a/tests/test_keyboardbutton.py b/tests/test_keyboardbutton.py
--- a/tests/test_keyboardbutton.py
+++ b/tests/test_keyboardbutton.py
@@ -85,7 +85,8 @@ def test_equality(self):
         a = KeyboardButton("test", request_contact=True)
         b = KeyboardButton("test", request_contact=True)
         c = KeyboardButton("Test", request_location=True)
-        d = InlineKeyboardButton("test", callback_data="test")
+        d = KeyboardButton("Test", web_app=WebAppInfo(url="https://ptb.org"))
+        e = InlineKeyboardButton("test", callback_data="test")
 
         assert a == b
         assert hash(a) == hash(b)
@@ -95,3 +96,6 @@ def test_equality(self):
 
         assert a != d
         assert hash(a) != hash(d)
+
+        assert a != e
+        assert hash(a) != hash(e)
diff --git a/tests/test_webhookinfo.py b/tests/test_webhookinfo.py
--- a/tests/test_webhookinfo.py
+++ b/tests/test_webhookinfo.py
@@ -105,7 +105,6 @@ def test_equality(self):
             pending_update_count=self.pending_update_count,
             last_error_date=self.last_error_date,
             max_connections=self.max_connections,
-            last_synchronization_error_date=self.last_synchronization_error_date,
         )
         b = WebhookInfo(
             url=self.url,
@@ -121,7 +120,15 @@ def test_equality(self):
             last_error_date=0,
             max_connections=1,
         )
-        d = LoginUrl("text.com")
+        d = WebhookInfo(
+            url="http://github.com",
+            has_custom_certificate=True,
+            pending_update_count=78,
+            last_error_date=0,
+            max_connections=1,
+            last_synchronization_error_date=123,
+        )
+        e = LoginUrl("text.com")
 
         assert a == b
         assert hash(a) == hash(b)
@@ -132,3 +139,6 @@ def test_equality(self):
 
         assert a != d
         assert hash(a) != hash(d)
+
+        assert a != e
+        assert hash(a) != hash(e)