Skip to content

Commit 9f330c2

Browse files
committed
update tests and py2rst to reflect some changes made to the pep
1 parent 0b3ff6e commit 9f330c2

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/py2rst.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ def flush_code():
3434
code_buffer.pop()
3535

3636
if code_buffer:
37-
result.append('::')
38-
result.append('')
37+
last_nonempty = next((l for l in reversed(result) if l.strip()), None)
38+
if last_nonempty is not None and last_nonempty.rstrip().endswith('::'):
39+
pass # preceding text already ends with ::
40+
else:
41+
result.append('::')
42+
result.append('')
3943
for line in code_buffer:
4044
result.append(' ' + line if line.strip() else '')
4145
result.append('')

tests/test_fastapilike_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Field[T: FieldArgs](typing.InitField[T]):
7373
# Begin PEP section: Automatically deriving FastAPI CRUD models
7474
"""
7575
We have a more `fully-worked example <#fastapi-test_>`_ in our test
76-
suite, but here is a possible implementation of just ``Public``
76+
suite, but here is a possible implementation of just ``Public``::
7777
"""
7878

7979
# Extract the default type from an Init field.

tests/test_qblike_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def select[ModelT, K: typing.BaseTypedDict](
7070
raise NotImplementedError
7171

7272

73-
"""ConvertField is our first type helper, and it is a conditional type
73+
"""``ConvertField`` is our first type helper, and it is a conditional type
7474
alias, which decides between two types based on a (limited)
7575
subtype-ish check.
7676

0 commit comments

Comments
 (0)