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

Issue:
[BUG] telegram.SecureValue is missing from documentation & tests
It seems that `telegram.SecureValue` has always been missing from the documentation and from the imports (`__all__`). Strange that this has gone unnoticed till now, but better late than never right?


Discussion:
@harshil21 IISC none of the classes in <code>tg.passport.credentials</code> have standalone tests either (although <a href="https://codecov.io/gh/python-telegram-bot/python-telegram-bot/src/eee892159833678ef56db6201434c5ae7fa8fd48/telegram/passport/credentials.py">it seems like</a> they&#x27;re at least implicitly tested, probably in <code>test_passport.py</code>. @jsmnbom @EchteEldin was there a specific reason to leave those out in #1168? Otherwise it would probably be good to add those, too …
@harshil21 So according to Noam testing was just too much of a hassle, so it was skipped. Not gonna try and do it myself … But we could at least leave a big nice note in <code>test_passport.py</code> that we&#x27;re aware that it&#x27;s not tested and there were reasons for it.
But, the issue is about documentation?

Resolving patch:
diff --git a/telegram/__init__.py b/telegram/__init__.py
--- a/telegram/__init__.py
+++ b/telegram/__init__.py
@@ -139,6 +139,7 @@
     Credentials,
     DataCredentials,
     SecureData,
+    SecureValue,
     FileCredentials,
     TelegramDecryptionError,
 )
@@ -147,24 +148,37 @@
 
 __author__ = 'devs@python-telegram-bot.org'
 
-__all__ = [
+__all__ = (  # Keep this alphabetically ordered
+    'Animation',
     'Audio',
     'Bot',
+    'BotCommand',
+    'CallbackGame',
+    'CallbackQuery',
     'Chat',
+    'ChatAction',
+    'ChatLocation',
     'ChatMember',
     'ChatPermissions',
-    'ChatAction',
+    'ChatPhoto',
     'ChosenInlineResult',
-    'CallbackQuery',
     'Contact',
+    'Credentials',
+    'DataCredentials',
+    'Dice',
     'Document',
+    'EncryptedCredentials',
+    'EncryptedPassportElement',
     'File',
+    'FileCredentials',
     'ForceReply',
+    'Game',
+    'GameHighScore',
+    'IdDocumentData',
     'InlineKeyboardButton',
     'InlineKeyboardMarkup',
     'InlineQuery',
     'InlineQueryResult',
-    'InlineQueryResult',
     'InlineQueryResultArticle',
     'InlineQueryResultAudio',
     'InlineQueryResultCachedAudio',
@@ -177,6 +191,7 @@
     'InlineQueryResultCachedVoice',
     'InlineQueryResultContact',
     'InlineQueryResultDocument',
+    'InlineQueryResultGame',
     'InlineQueryResultGif',
     'InlineQueryResultLocation',
     'InlineQueryResultMpeg4Gif',
@@ -184,28 +199,70 @@
     'InlineQueryResultVenue',
     'InlineQueryResultVideo',
     'InlineQueryResultVoice',
-    'InlineQueryResultGame',
     'InputContactMessageContent',
     'InputFile',
     'InputLocationMessageContent',
+    'InputMedia',
+    'InputMediaAnimation',
+    'InputMediaAudio',
+    'InputMediaDocument',
+    'InputMediaPhoto',
+    'InputMediaVideo',
     'InputMessageContent',
     'InputTextMessageContent',
     'InputVenueMessageContent',
+    'Invoice',
+    'KeyboardButton',
+    'KeyboardButtonPollType',
+    'LabeledPrice',
     'Location',
-    'ChatLocation',
-    'ProximityAlertTriggered',
-    'EncryptedCredentials',
-    'PassportFile',
-    'EncryptedPassportElement',
-    'PassportData',
+    'LoginUrl',
+    'MAX_CAPTION_LENGTH',
+    'MAX_FILESIZE_DOWNLOAD',
+    'MAX_FILESIZE_UPLOAD',
+    'MAX_MESSAGES_PER_MINUTE_PER_GROUP',
+    'MAX_MESSAGES_PER_SECOND',
+    'MAX_MESSAGES_PER_SECOND_PER_CHAT',
+    'MAX_MESSAGE_LENGTH',
+    'MaskPosition',
     'Message',
     'MessageEntity',
+    'MessageId',
+    'OrderInfo',
     'ParseMode',
+    'PassportData',
+    'PassportElementError',
+    'PassportElementErrorDataField',
+    'PassportElementErrorFile',
+    'PassportElementErrorFiles',
+    'PassportElementErrorFrontSide',
+    'PassportElementErrorReverseSide',
+    'PassportElementErrorSelfie',
+    'PassportElementErrorTranslationFile',
+    'PassportElementErrorTranslationFiles',
+    'PassportElementErrorUnspecified',
+    'PassportFile',
+    'PersonalDetails',
     'PhotoSize',
-    'ReplyKeyboardRemove',
+    'Poll',
+    'PollAnswer',
+    'PollOption',
+    'PreCheckoutQuery',
+    'ProximityAlertTriggered',
     'ReplyKeyboardMarkup',
+    'ReplyKeyboardRemove',
     'ReplyMarkup',
+    'ResidentialAddress',
+    'SUPPORTED_WEBHOOK_PORTS',
+    'SecureData',
+    'SecureValue',
+    'ShippingAddress',
+    'ShippingOption',
+    'ShippingQuery',
     'Sticker',
+    'StickerSet',
+    'SuccessfulPayment',
+    'TelegramDecryptionError',
     'TelegramError',
     'TelegramObject',
     'Update',
@@ -213,65 +270,7 @@
     'UserProfilePhotos',
     'Venue',
     'Video',
+    'VideoNote',
     'Voice',
-    'MAX_MESSAGE_LENGTH',
-    'MAX_CAPTION_LENGTH',
-    'SUPPORTED_WEBHOOK_PORTS',
-    'MAX_FILESIZE_DOWNLOAD',
-    'MAX_FILESIZE_UPLOAD',
-    'MAX_MESSAGES_PER_SECOND_PER_CHAT',
-    'MAX_MESSAGES_PER_SECOND',
-    'MAX_MESSAGES_PER_MINUTE_PER_GROUP',
     'WebhookInfo',
-    'Animation',
-    'Game',
-    'GameHighScore',
-    'VideoNote',
-    'LabeledPrice',
-    'SuccessfulPayment',
-    'ShippingOption',
-    'ShippingAddress',
-    'PreCheckoutQuery',
-    'OrderInfo',
-    'Invoice',
-    'ShippingQuery',
-    'ChatPhoto',
-    'StickerSet',
-    'MaskPosition',
-    'CallbackGame',
-    'InputMedia',
-    'InputMediaPhoto',
-    'InputMediaVideo',
-    'PassportElementError',
-    'PassportElementErrorFile',
-    'PassportElementErrorReverseSide',
-    'PassportElementErrorFrontSide',
-    'PassportElementErrorFiles',
-    'PassportElementErrorDataField',
-    'PassportElementErrorFile',
-    'Credentials',
-    'DataCredentials',
-    'SecureData',
-    'FileCredentials',
-    'IdDocumentData',
-    'PersonalDetails',
-    'ResidentialAddress',
-    'InputMediaVideo',
-    'InputMediaAnimation',
-    'InputMediaAudio',
-    'InputMediaDocument',
-    'TelegramDecryptionError',
-    'PassportElementErrorSelfie',
-    'PassportElementErrorTranslationFile',
-    'PassportElementErrorTranslationFiles',
-    'PassportElementErrorUnspecified',
-    'Poll',
-    'PollOption',
-    'PollAnswer',
-    'LoginUrl',
-    'KeyboardButton',
-    'KeyboardButtonPollType',
-    'Dice',
-    'BotCommand',
-    'MessageId',
-]
+)


Test patch:
diff --git a/tests/test_passport.py b/tests/test_passport.py
--- a/tests/test_passport.py
+++ b/tests/test_passport.py
@@ -31,27 +31,12 @@
     TelegramDecryptionError,
 )
 
-# Generated using the scope:
-# {
-#   data: [
-#     {
-#       type: 'personal_details',
-#       native_names: true
-#     },
-#     {
-#       type: 'id_document',
-#       selfie: true,
-#       translation: true
-#     },
-#     {
-#       type: 'address_document',
-#       translation: true
-#     },
-#     'address',
-#     'email'
-#   ],
-#   v: 1
-# }
+
+# Note: All classes in telegram.credentials (except EncryptedCredentials) aren't directly tested
+# here, although they are implicitly tested. Testing for those classes was too much work and not
+# worth it.
+
+
 RAW_PASSPORT_DATA = {
     'credentials': {
         'hash': 'qB4hz2LMcXYhglwz6EvXMMyI3PURisWLXl/iCmCXcSk=',