14. Test: Tables in freeform and itemized content

This section is informative.

Preamble

normative sections

  • Contract, Public classes, Public variables, Public types

Contract

general

  • Must demonstrate the HTML rendering of tables

Description

This module demonstrates the rendering of tables in the Sphinx extension and the pipeline JSON -> HTML5.

Tables can be used in the following sections:

  • Description

  • Definitions.<item>

  • Terminology.<item>

  • Notes.<item>

  • Factory.<item>

  • Class_overview.<item>

  • Function_overview.<item>

  • Method_overview.<item>

  • Returns

  • Parameters.<item>

  • Raises.<item> (allowed although item-like)

They are not allowed in lists of strings:

  • Preamble.*

  • Derived_from

They are not allowed in item-like (sub)sections like:

  • Contract.general

  • Contract.constructor

  • Contract.requires

  • Contract.ensures

  • Contract.invariants

Notes

Application

The following table shows where tables are allowed:

Sections in canonical order

Allowed / Applicable

Preamble.*

no

Definitions.<item>

yes

Terminology.<item>

yes

Contract.*

no

Description

yes

Derived_from

no

Factory.<item>

yes

Public_classes

no

Class_overview

yes

Public_functions

no

Function_overview

yes

Public_methods

no

Method_overview

yes

Public_types

yes

Public_variables

yes

Public_constants

yes

Parameters.<item>

yes

Returns

yes

Raises.<item>

yes

Notes.<item>

yes

See_also

no

Public classes

X

Class overview

X

The plugin controller. Plugins are initialized according to the following table:

Name

Initialization

fancy_plugin_a

LAZY

fancy_plugin_b

LOAD

Public variables

location

Location for expensive computations

Symbol

Semantics

LOCAL

Do computations on localhost

REMOTE

Do computations on remote host

Public types

RemoteAccess_t

Type Alias for Literal[‘SSH’, ‘HTTPS’]

Symbols which describe access to remote files

Symbol

Semantics

"SSH"

Access remote files through ssh, sftp, scp. Requires public key on remote host.

"HTTPS"

Access remote files through https. Requires token from remote host.

Module

test_tables

Waterloo module context

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

Preamble

normative sections

  • Contract, Factory

Contract

general

  • Must demonstrate a table with multiple groups

constructor

Factory

make_X_minimal

  • Must create a minimal instance of X.

make_X_complete

  • Must create a complete instance of X.

make_X_by_config

  • Must create an instance of X based on the configuration passed.

  • Must accept a single parameter config: Dict[str,Any].

  • Parameter config is map of key-value pairs:

Required

Key

Type

Requirements

base_prime

int

Prime used for encryption.

Optional

Key

Type

Default

path_to_log

str

/var/log/fancy.log.

Notes

Test

The Notes section allows tables. The following is a table with two distinct groups, each have a title row.

Input Variables

Name

Type

in_host

string

in_port

int

Output Variables

Name

Type

out_length

int

out_payload

bytes

Class

X –⁠ from test_tables

Signature

test_tables.log(
level: Literal[‘DEBUG’, ‘INFO’, ‘WARNING’, ‘ERROR’, ‘CRITICAL’]
msg: str
) -> None

Preamble

normative sections

  • Contract, Parameters, Raises, Returns

Contract

general

  • Must demonstrate tables in subsection Parameters.<item>.

requires

  • msg must not be empty

ensures

  • Must not change the state of the module.

Parameters

level

A string indicating the minimum severeness of messages to be logged.

Symbol

Semantics

"DEBUG"

Rich debugging output, not recommended in productive environment

"INFO"

Normal behaviour

"WARNING"

Requires attention but most likely the system remains operational

"ERROR"

Administrative action is required

"CRITICAL"

System has become unusable

msg

The message to be logged

Raises

ValueError

  • Must raise if msg is empty.

Returns

None

Function

log –⁠ from test_tables

Signature

test_tables.init_nothrow(
) -> int

Preamble

normative sections

  • Contract, Parameters, Raises, Returns

Contract

general

  • Must demonstrate tables in sections Description and Returns.

Description

This function initializes the module. Relevant files are

Path

Purpose

/etc/fancy.conf

Configuration

/var/log/fancy.log

General log

/var/log/fancy.auth.log

Log for authentication problems

Parameters

<empty>

Raises

<empty>

Returns

Must return one of the following values:

Status

String representation

Semantics

0

ok

No error

1

general_error

General error

2

io_error

Error accessing file system

3

bad_config

Invalid configuration

Function

init_nothrow –⁠ from test_tables

Signature

test_tables.init(
) -> None

Preamble

normative sections

  • Contract, Parameters, Raises, Returns

Contract

general

  • Must demonstrate tables in sections Raises.

Parameters

<empty>

Raises

MyException

  • Must raise in case of an error in the controller

  • Must provide an error codes according to the following scheme:

Value

String representation

Semantics

1

general_error

General error

2

io_error

Error accessing file system

3

bad_config

Invalid configuration

  • Must raise if initialization of any of the plugins fails.

NotImplementedError

  • May raise if implementation in any of the plugins is incomplete.

  • May raise if implementation in any of the plugin registry classes is incomplete.

Returns

None

Function

init –⁠ from test_tables

Waterloo module context

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