style_test.py - Styling tests for CodeChat¶
This file contains no useful code, but serves as a test bed to make sure code to comment transitions are styled correctly.
Disable Black for this block. fmt: off
The syntax below prevents some linter complaints.
Docstrings¶
A function that checks if docstrings are dedented properly.
Check that multiple paragraphs work.
Check that indents (even this small one) work.
All reST types¶
Here are all the reST body elements, tested with intermingled code to check code to text back to code, following the order given in the reStructuredText Markup Specification.
Sections¶
and back¶
Sections¶
and back¶
Note that sections shouldn’t be indented, so they’re not tested here.
Transitions¶
A transition
and back.
A transition
and back.
An indented transition
and back.
An indented transition
and back.
Paragraphs¶
A plain paragraph
then back.
A plain paragraph
then back.
An indented paragraph
then back.
An indented paragraph
then back.
Bulleted lists¶
A bulleted list
and back.
A bulleted list
and back.
An indented bulleted list
and back.
An indented bulleted list
and back.
Enumerated lists
and back.
Enumerated lists
and back.
An indented enumerated list
and back.
An indented enumerated lists
and back.
Definition lists¶
- A definition
list
- and
back.
- A definition
list
- and
back.
- An indented definition
list
- and
back.
- An indented definition
list
- and
back.
Field lists¶
- A:
field list
- and:
back.
- A:
field list
- and:
back.
- An indented:
field list
- and:
back.
- An:
indented field list
- and:
back.
Option lists¶
- -An
option list
- -And
back
- -An
option list
- -And
back
- -An
indented option list
- -And
back.
- -An
indented option list
- -And
back.
Literal blocks¶
Testing is a bit tricky, since the styling is very close to code already.
A literal block
and back.
A literal block
and back.
An indented literal block
and back.
An indented literal block
and back.
Per-line quoting:
> for a literal block
and:
> back.
Per-line quoting:
> for a literal block
and:
> back.
Per-line quoting:
> for an indented literal block
and:
> back.
Per-line quoting:
> for an indented literal block
and:
> back.
Line blocks¶
Doctest blocks¶
>>> Doctest_blocks
>>> and_back
>>> Doctest_blocks
>>> and_back
>>> Indented_doctest_blocks
>>> and_back
>>> Indented_doctest_blocks
>>> and_back
Tables¶
A |
Table |
---|---|
1 |
two |
and |
back |
---|---|
1 |
two |
A |
Table |
---|---|
1 |
two |
and |
back |
---|---|
1 |
two |
An |
indented table |
---|---|
1 |
two |
and |
back |
---|---|
1 |
two |
An |
indented table |
---|---|
1 |
two |
and |
back |
---|---|
1 |
two |
Directives¶
Test some directives, following the order in the reStructuredText Directives document.
Admonitions¶
Attention¶
Attention
An attention directive
Attention
and back.
Attention
An attention directive
Attention
and back.
Attention
An indented attention directive
Attention
and back.
Attention
An indented attention directive
Attention
and back.
contents¶
Nested body elements¶
Test the behavior of nesting elements, making sure all margins get set properly.
One
Two
Three
Four
- Five
six
- Seven:
eight
- -Nine
ten
eleventwelve
and back.
I don’t know that more nesting really does any more testing.