Skip to content

Add test coverage for safety/emoji.py - #911

Open
userjuma wants to merge 1 commit into
pyupio:mainfrom
userjuma:add-emoji-module-tests
Open

Add test coverage for safety/emoji.py#911
userjuma wants to merge 1 commit into
pyupio:mainfrom
userjuma:add-emoji-module-tests

Conversation

@userjuma

Copy link
Copy Markdown

Description

safety/emoji.py had no test coverage at all — three pure functions (process_custom_emojis, process_rich_emojis_fallback, load_emoji) handling the custom :icon_*: namespace and ASCII fallbacks for environments that can't render emoji, with zero tests exercising any of it. Added a full test suite for the module.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Other (please describe): Test coverage addition

Related Issues

Related to #573

Testing

  • Tests added or updated
  • No tests required

Added tests/test_emoji.py with 14 tests covering: known icon/emoji codes replaced correctly (both unicode and ASCII fallback paths), unknown codes left untouched rather than stripped or mis-replaced, non-string input handled gracefully, multiple codes in one string, and the load_emoji() branching behavior specifically — Rich emoji codes are only touched when use_ascii=True, verified that stays true rather than assumed.

Ran the full suite (pytest -q): 885 passed, 14 skipped, 1 pre-existing unrelated flake in tests/auth/test_status.py (a timing assertion, duration_ms > 0, unrelated to this change).

Checklist

  • Code is well-documented
  • Changelog is updated (if needed)
  • No sensitive information (e.g., keys, credentials) is included in the code
  • All PR feedback is addressed

Additional Notes

Picked this up via the general test-coverage issue (#573), which asks contributors to find an untested area and link back — emoji.py had no matching test file in tests/.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5abc925c-8152-4a9d-b6a0-daeba9c373c2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant