fix(tools): treat a whitespace-only description as absent in the Python SDK

It collapsed to '' rather than undefined, so the renderer emitted an empty
`""""""` docstring or a bare `#   ` line for a node that documents nothing.
This commit is contained in:
Chinesezjc
2026-08-05 14:05:02 +08:00
parent 3f7707e9aa
commit a1d7b9a3cd
2 changed files with 14 additions and 3 deletions

View File

@@ -464,6 +464,13 @@ describe('renderToolsSdkPy', () => {
// Subscript entry appears without the "# ..." description follow-up.
expect(text).toContain('# tools["weird-name"]')
expect(text.split('\n').every(line => !line.startsWith(' # '))).toBe(true)
// A whitespace-only description collapses to nothing and is treated as
// absent: no empty `""""""` docstring, no bare `# ` line.
const blank = renderToolsSdkPy([
{ ...undescribedIdentifier, description: ' \t\n ' },
{ ...undescribedExotic, description: ' ' },
])
expect(blank).toBe(text)
})
it('marks an open object TypedDict and declares a closed empty object', () => {