docs(tools): close the NEL half of the raw pass-through and reflow

Four non-blocking review suggestions, all prose plus one assertion.

`UNPRINTABLE`'s new sentence named three characters but only two raw-reach
points, leaving "and NEL?" open; it now says all three reach text through
`pyScalar`, and how the description path handles each. `pyScalar`'s
raw-pass-through list already covered NEL under "the C1 controls", and the
test now pins it alongside LS and PS, so the docstring's claim has a
mechanical check for every character it names.

The test title said "paragraph separators" for a pair whose first member is
LINE SEPARATOR. Two docstring paragraphs are reflowed to the file's ~80
columns after the earlier inserts left short lines.

The note's CPython-floor obligation gains a second axis: the `typing` names
the block spells (`TypedDict` 3.8, `NotRequired` 3.11, `A | B` annotations
3.10) are definition-time evaluation floors, not parse floors, so the floor PR
does not read "parseable on the supported range" as "executable on it".
This commit is contained in:
Chinesezjc
2026-08-05 22:43:42 +08:00
parent 05213ec85f
commit b869a3b078
5 changed files with 31 additions and 27 deletions

View File

@@ -67,17 +67,20 @@ describe('jsonSchemaToPy', () => {
expect(jsonSchemaToPy({ type: 'string', const: 'ends\\' })).toBe(String.raw`Literal["ends\\"]`)
})
it('passes the paragraph separators through raw, which CPython does not treat as line terminators', () => {
// `JSON.stringify` escapes LF and CR but not LS/PS (U+2028/U+2029), which
// is safe here and not by accident: they are `str.splitlines()` boundaries,
// not tokenizer line terminators, so they end neither a string literal nor
// a `#` comment — measured on CPython 3.9.6 and 3.12.13. Pinning the raw
// form keeps a later "escape them for symmetry with LF" change from
// landing as a silent both-flavors divergence from `ts-types`.
// Escapes below — the two forms denote the same bytes, and neither
// character has a visible width.
it('passes the line and paragraph separators through raw, which CPython does not treat as line terminators', () => {
// `JSON.stringify` escapes LF and CR but not NEL (U+0085), LS (U+2028), or
// PS (U+2029), which is safe here and not by accident: those three are
// `str.splitlines()` boundaries, not tokenizer line terminators, so they
// end neither a string literal nor a `#` comment — measured on CPython
// 3.9.6 and 3.12.13. Pinning the raw form keeps a later "escape them for
// symmetry with LF" change from landing as a silent both-flavors
// divergence from `ts-types`. Escapes below — the two forms denote the
// same bytes, and none of the three has a visible width.
expect(jsonSchemaToPy({ type: 'string', const: 'a\u2028b' })).toBe('Literal["a\u2028b"]')
expect(jsonSchemaToPy({ type: 'string', enum: ['a\u2029b'] })).toBe('Literal["a\u2029b"]')
// NEL is inside `UNPRINTABLE`'s class, so the description path escapes it;
// this is the one route that carries it raw.
expect(jsonSchemaToPy({ type: 'string', const: 'a\u0085b' })).toBe('Literal["a\u0085b"]')
})
it('emits exact digits for a beyond-safe-range integer literal', () => {