12. Test: Flow control in freeform sections

This section is informative.

Here, we are testing how the Sphinx renderer handles free-form-content sections and itemized-content sections.

Preamble

  • normative sections

    • Contract, Definitions, Public classes, Public functions, Public types, Public variables, Public constants

Contract

  • general

Description

We test several freeform and bullet-list scenarios. A Description section is freeform content. A single pipe character “|” separates paragraphs within the freeform text.

This is the second paragraph. Here is an enumeration:

  1. Item 1

  2. Item 2

Definitions

Term_A

Definition content is freeform A single pipe character “|” separates paragraphs within the freeform text.

This is the second paragraph. Here is an enumeration

  1. Numbered item with long text, so that we use the backslash in order to create a logical line.

  2. Numbered item

Terminology

Term B

Terminology content is freeform. A single pipe character “|” separates paragraphs within the freeform text.

This is the second paragraph. Here is an item list:

  • Item 1

  • Item 2

Some text after the item list.

Notes

About

Notes content is freeform. A single pipe character “|” separates paragraphs within the freeform text.

This is the second paragraph. Here is an item list:

  • Item 1

  • Item 2

Some text after the item list.

Public classes

X

Public functions

f

Class overview

  • X

    A class overview is not normative. The content is a sequence of paragraphs.

    This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    • An item

      1. Numbered item

      2. Numbered item

    • An item

Function overview

  • f

    A function overview is not normative. The content is a sequence of paragraphs.

    This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    1. Numbered item

      • An item

      • An item

    2. Numbered item

Public types

  • MyType

    Public_types is normative. The content is a sequence of paragraphs. This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    1. Numbered item

      • An item

      • An item

    2. Numbered item

Public variables

  • my_variable

    Public_variables is normative. The content is a sequence of paragraphs. This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    1. Numbered item

      • An item

      • An item

    2. Numbered item

Public constants

  • my_constant

    Public_constants is normative. The content is a sequence of paragraphs. This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    • An item

      • A subitem

        • A subsubitem

        • A subsubitem

      • A subitem

    • An item

Module

test_flow_control

Classes and functions below this point implicitly belong to package/module test_flow_control.

Preamble

  • normative sections

    • Contract, Factory, Public methods

Contract

  • general

    • Subsections in Contract are line-based. This is the first logical line. Use backslash to merge physical lines to a logical line.

    • This is the second logical line. Itemization is not supported inside these logical lines.

    • A sequence of logical lines in the contract is meant to represent a line-by-line executable contract.

  • constructor

    • Same format as Contract.general.

    • This is the second logical line.

Factory

  • make_X

    • Line-based text flow is enforced as in Contract. Use backslash to merge physical lines to a logical line.

    • This is the second logical line. Factories are not so different from constructors in terms of documentation. The content is interpreted as a line-by-line executable contract.

Public methods

m

Method overview

  • m

    A method overview is not normative. The content is a sequence of paragraphs.

    This is the second paragraph. A single pipe character “|” separates paragraphs within the freeform text.

    Itemizations and enumerations are possible:

    1. Numbered item

      • An item

      • An item

    2. Numbered item

Class

X

Signature

test_flow_control.f(
rng: Tuple[int, int]
b: str
) -> Tuple[float, int, List[str]]

Preamble

  • normative sections

    • Contract, Parameters, Returns, Raises

Contract

  • general

    • Same format as for profile class.

    • Second line.

  • requires

    • Same format as Contract.general

    • Second line.

  • ensures

    • Same format as Contract.general

    • Second line.

  • invariants

    • Same format as Contract.general

    • Second line.

Returns

As opposed to the Contract sections, the Return section is intepreted as a freeform text. A single pipe character “|” separates paragraphs within the freeform text.

The free form allows us to itemize and enumerate. We can use this in order to describe the structure of the returned value, e.g.

The returned value has the form (u,v,[r,s]) where

  • u is …

  • v is …

  • [r,s] consist of the following:

    • r which is …

    • s which is …

Parameters

  • rng

    Like the Returns section, parameter entries support freeform text with itemization and enumeration, which allows to resolve the inner structure of parameters. Example

    • Component 0 is the beginning of the range.

    • Component 1 is the (eclusive) end of the range.

  • b

    Nonetheless, line-by-line executable contract style is possible by explicit itemization:

    • Must represent …

    • Must fulfill …

    This may overlap with the requires section. In case of a thematic overlap, a detailed requires section should be preferred.

Raises

<empty>
Function

f

Default module qualifier test_flow_control ends here. No default module active.