Skip to content

🧪 Add unit test for empty __all__ tuple generation#6

Merged
bashandbone merged 3 commits intomainfrom
fix/test-empty-all-tuple-generation-1988618892330088680
Mar 13, 2026
Merged

🧪 Add unit test for empty __all__ tuple generation#6
bashandbone merged 3 commits intomainfrom
fix/test-empty-all-tuple-generation-1988618892330088680

Conversation

@bashandbone
Copy link
Contributor

🎯 What: The testing gap addressed
The method CodeGenerator._generate_all_tuple was missing a direct test to verify that calling it with an empty sequence [] properly returns "__all__ = ()".

📊 Coverage: What scenarios are now tested
Added test_generate_all_tuple_empty to directly test the aforementioned edge case and assert that result == "__all__ = ()". I also fixed a failing test related to tests/fixtures/sample_type_aliases.py where supposed pre-Python 3.12 type aliases incorrectly used the Python 3.12 type syntax.

Result: The improvement in test coverage
The specific edge case is now covered directly by the unit tests.


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

Adds `test_generate_all_tuple_empty` to `tests/test_generator.py` to directly verify that `_generate_all_tuple([])` returns `"__all__ = ()"`. This closes a testing gap in the coverage.

Also fixes a failing test related to `tests/fixtures/sample_type_aliases.py` where supposed pre-Python 3.12 type aliases incorrectly used the Python 3.12 `type` syntax.

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:25
type NamePair = tuple[str, str]
from typing import TypeAlias

FilePath: TypeAlias = str | Path
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Fixes a linting error introduced in the previous commit. The `tests/fixtures/sample_type_aliases.py` file uses intentional legacy syntax to test backwards compatibility in the `ASTParser`. Ignoring rule UP040 prevents ruff from automatically rewriting these to use the new `type` keyword, avoiding tests from breaking in CI.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
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

Updates tests and fixtures to improve coverage and ensure type-alias fixtures correctly represent both pre-3.12 and 3.12+ alias styles for the AST parser.

Changes:

  • Add a unit test covering empty __all__ tuple generation.
  • Update the type-alias fixture to use TypeAlias assignments for “pre-3.12” style aliases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_generator.py Adds coverage for the empty-exports __all__ tuple formatting branch.
tests/fixtures/sample_type_aliases.py Corrects the “pre-3.12” fixture aliases to use TypeAlias instead of the 3.12 type statement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 22 to +26
# Pre-3.12 style type aliases (X: TypeAlias = Y)
type FilePath = str | Path
type ModuleName = str
type RulePattern = str
type ExportName = str
type ErrorMessage = str
type ConfigDict = dict[str, str | int | bool | list[str]]
type NamePair = tuple[str, str]
from typing import TypeAlias

FilePath: TypeAlias = str | Path
ModuleName: TypeAlias = str
…92330088680

Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
@bashandbone bashandbone merged commit 8d76d0f into main Mar 13, 2026
5 of 9 checks passed
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