ecap5_treq.matrix module

class ecap5_treq.matrix.Matrix(path=None)

Bases: object

A Matrix contains the traceability data between checks and requirements

add(check_id: str, traced_reqs: list[Req]) None

Adds traceability data to the matrix

Parameters:
  • check_id (str) – id of the check used to identify the traceability data

  • traced_reqs (list[Req]) – list of requirements traced to the check_id

add_untraceable(rid: str, justification: str = '') None

Adds untraceable traceability data to the matrix

Parameters:
  • rid (str) – untraceable requirement id

  • justification (str) – untraceable requirement justification

check(checks: list[Check]) bool

Checks if the checks in the matrix are strictly equal to the checks provided as parameter

Parameters:

checks (list[Check]) – the list of checks to verify against

Returns:

a boolean indicating the result of the comparison

Return type:

bool

get(check_id: str) list[Req]

Return the requirements traced to check_id

Parameters:

check_id (str) – id of the check used to identify the traceability data

Returns:

the list of requirements traced to check_id

Return type:

list[Req]

read(path: str) None

Reads the traceability matrix from the file pointed by path

Parameters:

path (str) – path to the traceability matrix

Returns:

a pointer to the read matrix

Return type:

Matrix

to_csv() str

Converts this object to a csv string

Returns:

a csv string of the matrix

Return type:

str

ecap5_treq.matrix.prepare_matrix(checks: list[Check], previous_matrix: Matrix) Matrix

Generates an updated traceability matrix with an up-to-date list of checks.

Parameters:
  • checks (list[Check]) – list of checks to include in the matrix

  • previous_matrix (Matrix) – previous matrix from which the previous traceability is recovered.

Returns:

the updated traceability matrix

Return type:

Matrix