🧪 Add comprehensive tests for _render_all edge cases#9
Conversation
Added tests in `tests/test_module_all.py` to cover the single-item edge case of `_render_all` in `exportify.export_manager.module_all` as well as empty and multiple-item cases. Also fixed a related regression in a test fixture (`tests/fixtures/sample_type_aliases.py`). Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Added `# ruff: noqa: UP040` directive to `tests/fixtures/sample_type_aliases.py` to prevent ruff from flagging the legacy `TypeAlias` syntax. This file is deliberately testing the old syntax so we need to suppress the auto-fixing linter rule for this specific module. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds coverage and fixtures to support/validate exportify’s AST/type-alias detection and __all__ rendering behavior.
Changes:
- Add unit tests for
exportify.export_manager.module_all._render_alloutput formatting. - Update the
sample_type_aliases.pyfixture to useTypeAlias-annotated assignments for “pre-3.12 style” aliases while retainingtype X = Yaliases for 3.12+.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/test_module_all.py | New tests validating __all__ rendering for empty/single/multiple names and list/tuple formats. |
| tests/fixtures/sample_type_aliases.py | Fix fixture to actually include pre-3.12-style aliases via TypeAlias, alongside 3.12+ type aliases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/test_module_all.py
Outdated
| from exportify.export_manager.module_all import _render_all | ||
|
|
||
| def test_render_all_empty(): |
| assert _render_all(["MyClass"], "tuple") == '__all__ = ("MyClass",)' | ||
|
|
||
| def test_render_all_multiple_items(): | ||
| expected_list = '__all__ = [\n "A",\n "B",\n]' |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
…74949 Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
🎯 What: The testing gap addressed
The
_render_allfunction insrc/exportify/export_manager/module_all.pyhad untested edge cases, specifically when rendering an__all__list with only a single item (lines 205-206).📊 Coverage: What scenarios are now tested
A new test file
tests/test_module_all.pywas created to test_render_all. It comprehensively covers:Additionally, a regression issue in
tests/fixtures/sample_type_aliases.py(which affectedtest_type_alias_detection.py) was also fixed where legacyTypeAliasitems had inadvertently been updated to the Python 3.12typesyntax, causing the test fixture to fail on its pre-3.12 alias detection assertion.✨ Result: The improvement in test coverage
The code formatting logic inside
_render_allis now fully tested, preventing regressions when formatting__all__list/tuple outputs.PR created automatically by Jules for task 7512482837841174949 started by @bashandbone