Skip to content

Handle unnamed enum.Flag values in the renderer - #83

Closed
Linxiushen wants to merge 1 commit into
google-deepmind:mainfrom
Linxiushen:codex/render-unnamed-enum-flags
Closed

Linxiushen wants to merge 1 commit into
google-deepmind:mainfrom
Linxiushen:codex/render-unnamed-enum-flags

Conversation

@Linxiushen

Copy link
Copy Markdown

Rendering a valid enum.Flag value such as Permissions(0) or an unnamed Permissions.READ | Permissions.WRITE currently raises TypeError or AttributeError: its name is either None or a composite name that is not a class attribute. The failure occurs through the normal text and HTML rendering APIs with strict error handling.

Preserve the existing qualified member form for named members and aliases, and render unnamed flag values as Permissions(value). Add regression coverage for zero values, combinations, complements, named zero/composite members, aliases, ordinary enums, strict HTML rendering, copy keypaths, and reconstruction from roundtrip text.

Validation on Windows with Python 3.12.14:

  • New regression file: 30 passed. With the same final test bytes on unchanged main, 9 fail with the flag exceptions and 21 pass.
  • Regression plus existing renderer tests: 109 passed, 1 skipped; the separately confirmed baseline test_closure_rendering path assertion is deselected.
  • Full suite: unchanged main 10 failed / 194 passed / 1 skipped; candidate 1 failed / 203 passed / 1 skipped. The remaining failure is the same pre-existing assertion expecting tests/renderer_test.py inside a Windows backslash path.
  • pyink treescope tests --check: 64 files unchanged. pylint treescope: 10.00/10.

The project's Ubuntu/Python 3.10.14 CI has not been run locally. Both changed files parse with Python 3.10 syntax; that is not runtime or type-checking evidence. pytype has not been run on Windows (the locked release has no Windows wheel), so its Linux CI result remains pending.
AI assistance: implementation, regression tests and diff review were prepared with Codex.

@danieldjohnson

Copy link
Copy Markdown
Collaborator

Closing this PR since the contributions appear to be automated and unrelated to real-world use of this library.

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.

2 participants