Skip to content

🧪 Add comprehensive tests for _render_all edge cases#9

Merged
bashandbone merged 5 commits intomainfrom
fix-test-render-all-edge-case-7512482837841174949
Mar 13, 2026
Merged

🧪 Add comprehensive tests for _render_all edge cases#9
bashandbone merged 5 commits intomainfrom
fix-test-render-all-edge-case-7512482837841174949

Conversation

@bashandbone
Copy link
Contributor

🎯 What: The testing gap addressed
The _render_all function in src/exportify/export_manager/module_all.py had 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.py was created to test _render_all. It comprehensively covers:

  • Empty lists and tuples.
  • Single-item lists and tuples (closing the identified testing gap).
  • Multi-item lists and tuples to verify correct formatting.
    Additionally, a regression issue in tests/fixtures/sample_type_aliases.py (which affected test_type_alias_detection.py) was also fixed where legacy TypeAlias items had inadvertently been updated to the Python 3.12 type syntax, 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_all is now fully tested, preventing regressions when formatting __all__ list/tuple outputs.


PR created automatically by Jules for task 7512482837841174949 started by @bashandbone

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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 13, 2026 02:28
@codecov-commenter
Copy link

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>
type ErrorMessage = str
type ConfigDict = dict[str, str | int | bool | list[str]]
type NamePair = tuple[str, str]
FilePath: TypeAlias = str | Path
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_all output formatting.
  • Update the sample_type_aliases.py fixture to use TypeAlias-annotated assignments for “pre-3.12 style” aliases while retaining type X = Y aliases 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.

Comment on lines +1 to +3
from exportify.export_manager.module_all import _render_all

def test_render_all_empty():
Comment on lines +9 to +12
assert _render_all(["MyClass"], "tuple") == '__all__ = ("MyClass",)'

def test_render_all_multiple_items():
expected_list = '__all__ = [\n "A",\n "B",\n]'
bashandbone and others added 3 commits March 12, 2026 23:41
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>
@bashandbone bashandbone merged commit a32b419 into main Mar 13, 2026
5 of 9 checks passed
@bashandbone bashandbone deleted the fix-test-render-all-edge-case-7512482837841174949 branch March 13, 2026 03:53
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.

3 participants