From 8a6bbe91e3c21094658d24cca9903f5048984266 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 02:28:11 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A7=AA=20Add=20test=20cases=20for=20s?= =?UTF-8?q?ingle=20item=20`=5Frender=5Fall`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- tests/fixtures/sample_type_aliases.py | 16 ++++++++-------- tests/test_module_all.py | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 tests/test_module_all.py diff --git a/tests/fixtures/sample_type_aliases.py b/tests/fixtures/sample_type_aliases.py index 0e1426c..199e06d 100644 --- a/tests/fixtures/sample_type_aliases.py +++ b/tests/fixtures/sample_type_aliases.py @@ -12,7 +12,7 @@ from __future__ import annotations from pathlib import Path -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, TypeAlias if TYPE_CHECKING: @@ -20,13 +20,13 @@ test_file_path: FilePath | None = None # 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] +FilePath: TypeAlias = str | Path +ModuleName: TypeAlias = str +RulePattern: TypeAlias = str +ExportName: TypeAlias = str +ErrorMessage: TypeAlias = str +ConfigDict: TypeAlias = dict[str, str | int | bool | list[str]] +NamePair: TypeAlias = tuple[str, str] # Python 3.12+ style type aliases (type X = Y) type FileContent = str diff --git a/tests/test_module_all.py b/tests/test_module_all.py new file mode 100644 index 0000000..959a552 --- /dev/null +++ b/tests/test_module_all.py @@ -0,0 +1,16 @@ +from exportify.export_manager.module_all import _render_all + +def test_render_all_empty(): + assert _render_all([], "list") == "__all__ = []" + assert _render_all([], "tuple") == "__all__ = ()" + +def test_render_all_single_item(): + assert _render_all(["MyClass"], "list") == '__all__ = ["MyClass"]' + assert _render_all(["MyClass"], "tuple") == '__all__ = ("MyClass",)' + +def test_render_all_multiple_items(): + expected_list = '__all__ = [\n "A",\n "B",\n]' + assert _render_all(["A", "B"], "list") == expected_list + + expected_tuple = '__all__ = (\n "A",\n "B",\n)' + assert _render_all(["A", "B"], "tuple") == expected_tuple From 57964e881cfdd5a4f7549d31fed3da4068df98be Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 02:30:17 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A7=AA=20Fix=20`ruff`=20UP040=20check?= =?UTF-8?q?s=20on=20test=20fixture=20`sample=5Ftype=5Faliases`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- tests/fixtures/sample_type_aliases.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/fixtures/sample_type_aliases.py b/tests/fixtures/sample_type_aliases.py index 199e06d..3f077d0 100644 --- a/tests/fixtures/sample_type_aliases.py +++ b/tests/fixtures/sample_type_aliases.py @@ -19,6 +19,7 @@ # Dummy usage of type aliases to keep static analyzers happy. test_file_path: FilePath | None = None +# ruff: noqa: UP040 # Pre-3.12 style type aliases (X: TypeAlias = Y) FilePath: TypeAlias = str | Path ModuleName: TypeAlias = str From 49e34954ee66f65cc1adddbe795179e9c03a4c2e Mon Sep 17 00:00:00 2001 From: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com> Date: Thu, 12 Mar 2026 23:41:09 -0400 Subject: [PATCH 3/4] Apply suggestions from code review 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> --- tests/test_module_all.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_module_all.py b/tests/test_module_all.py index 959a552..bf64f0b 100644 --- a/tests/test_module_all.py +++ b/tests/test_module_all.py @@ -1,13 +1,16 @@ from exportify.export_manager.module_all import _render_all + def test_render_all_empty(): assert _render_all([], "list") == "__all__ = []" assert _render_all([], "tuple") == "__all__ = ()" + def test_render_all_single_item(): assert _render_all(["MyClass"], "list") == '__all__ = ["MyClass"]' assert _render_all(["MyClass"], "tuple") == '__all__ = ("MyClass",)' + def test_render_all_multiple_items(): expected_list = '__all__ = [\n "A",\n "B",\n]' assert _render_all(["A", "B"], "list") == expected_list From a6768d5d24d86b08d564318801dc574479e327af Mon Sep 17 00:00:00 2001 From: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com> Date: Thu, 12 Mar 2026 23:41:53 -0400 Subject: [PATCH 4/4] Update test_module_all.py Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com> --- tests/test_module_all.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_module_all.py b/tests/test_module_all.py index bf64f0b..1993b0b 100644 --- a/tests/test_module_all.py +++ b/tests/test_module_all.py @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2026 Knitli Inc. +# +# SPDX-License-Identifier: MIT OR Apache-2.0 from exportify.export_manager.module_all import _render_all