Skip to content

Conversation

@souravkgit
Copy link

Purpose

Fix for #4514 - Consolidate sticker set tests to use mixed format sticker sets

Description

This PR refactors the sticker set tests in tests/_files/test_sticker.py to simplify and consolidate the test logic. Instead of maintaining separate sticker sets for static, animated, and video formats, the tests now use a single mixed format sticker set that contains stickers in all three formats.

Changes Made

Key Improvements

  • Simplified test setup: Consolidated three separate sticker sets (static, animated, video) into one mixed format sticker set
  • Reduced API calls: Tests now create and manage a single sticker set instead of three separate ones, reducing Telegram API load
  • Better test organization: Renamed test methods to reflect their actual purpose (e.g., test_bot_methods_1_pngtest_bot_methods_1_add_stickers)
  • Improved code clarity: Added descriptive docstrings to test methods explaining what each test validates
  • Consistent formatting: Applied consistent code formatting and parameter naming throughout

Test Methods Consolidated

  • test_bot_methods_1_png, test_bot_methods_1_tgs, test_bot_methods_1_webmtest_bot_methods_1_add_stickers
  • test_bot_methods_2_png, test_bot_methods_2_tgs, test_bot_methods_2_webmtest_bot_methods_2_position
  • test_bot_methods_3_png, test_bot_methods_3_tgs, test_bot_methods_3_webmtest_bot_methods_3_thumbnail + test_bot_methods_3_webm_thumbnail
  • test_bot_methods_4_png, test_bot_methods_4_tgs, test_bot_methods_4_webmtest_bot_methods_4_delete
  • test_bot_methods_5_png, test_bot_methods_5_tgs, test_bot_methods_5_webmtest_bot_methods_5_emoji
  • test_bot_methods_6_png, test_bot_methods_6_tgs, test_bot_methods_6_webmtest_bot_methods_6_title
  • test_bot_methods_7_png, test_bot_methods_7_tgs, test_bot_methods_7_webmtest_bot_methods_7_keywords
  • test_bot_methods_8_pngtest_bot_methods_8_replace

Updated Fixtures

  • Modified test_create_sticker_set to create a single mixed sticker set with static, animated, and video formats
  • Updated test_delete_sticker_set to include both static and animated sticker formats
  • Updated test_set_custom_emoji_sticker_set_thumbnail to include video sticker format
  • Updated test_create_new_mask_sticker_set with descriptive docstring
  • Updated test_set_sticker_mask_position with descriptive docstring

Files Changed

  • tests/_files/test_sticker.py: Consolidated test methods and updated sticker set fixtures

Testing

  • All existing tests remain functionally equivalent and should continue to pass
  • Tests now use fewer API resources by consolidating sticker set creation
  • Test logic is clearer with improved docstrings and method naming

Checklist

  • Code changes are compatible with Python 3.9 to 3.14
  • Tests have been created or updated
  • Code is properly documented with clear docstrings
  • No breaking changes to public API (test-only changes)
  • Pre-commit checks pass

Related Issue

Closes #4514

@Bibo-Joshi
Copy link
Member

Hey there. Kindly have a look at my comment in #5038 (review). It basically applies 1:1 to this RP :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor test_sticker.py since sticker sets can now hold static, animated, and video altogether.

2 participants