No project description provided
Project description
cg_feedback_helpers
This package provides functionality to provide feedback messages. It
mainly provides the class Asserter. The Asserter has a number of
methods that are documented on the official
docs, which allow
to run assertions. Each assertion can provide either positive or negative
feedback. A few helpers are also provided to aid with input and output
coupled when running assertions. At the end of a run, call
Asserter::emit_success to guarantee the user receives some feedback
if everything was correct.
The package outputs feedback in the following format:
{
"tag": "feedback",
"contents": [
{
"value": <your feedback message>,
"sentiment": <"positive" | "negative">
},
]
}
Usage:
The following example shows how the asserter can be used to check that
the function greet_user responds with the correct output to a user
input.
from cg_feedback_helpers import asserter, helpers
def greet_user():
name = input()
print(f"Hi {name}")
with helpers.capture_output() as buffer, helpers.as_stdin("John"):
greet_user()
output = helpers.get_lines_from_buffer(buffer)
asserter.has_length(output, 1)
asserter.equals(output[0], "John")
asserter.emit_success()
The output of which will be:
{"tag":"feedback","contents":[{"value":"Got expected length 1","sentiment":"positive"}]}
{"tag":"feedback","contents":[{"value":"Got expected value Hi John","sentiment":"positive"}]}
{"tag":"feedback","contents":[{"value":"Everything was correct! Good job!","sentiment":"positive"}]}
Module contains:
Asserterclass, of which the default messages produced can be configured, as well as its failure behavior (either using exceptions orsys.exit);helpersto make it easier to work with input/output tests.
Limitation:
The module currently does not support markdown feedback, nor the
neutral sentiment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cg_feedback_helpers-1!1.0.4.tar.gz.
File metadata
- Download URL: cg_feedback_helpers-1!1.0.4.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52eea8b72a5986042d8fd9e817d864c94b35262cc44d6d98f7f9d5bdc61a0bda
|
|
| MD5 |
2bc3c1f019e9a23604b6f046afb5c7c9
|
|
| BLAKE2b-256 |
644c4a580eecad03cd39ad06f9c5466d7e6a3738a2f0be8f21a089a2bbc18c5f
|
Provenance
The following attestation bundles were made for cg_feedback_helpers-1!1.0.4.tar.gz:
Publisher:
production_build.yml on CodeGra-de/CodeGra.de
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cg_feedback_helpers-1!1.0.4.tar.gz -
Subject digest:
52eea8b72a5986042d8fd9e817d864c94b35262cc44d6d98f7f9d5bdc61a0bda - Sigstore transparency entry: 834566566
- Sigstore integration time:
-
Permalink:
CodeGra-de/CodeGra.de@5ba70728af938b7dab06021ddd2a74895e0f9d33 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/CodeGra-de
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
production_build.yml@5ba70728af938b7dab06021ddd2a74895e0f9d33 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cg_feedback_helpers-1!1.0.4-py3-none-any.whl.
File metadata
- Download URL: cg_feedback_helpers-1!1.0.4-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a366d09409ae65228f37a38952befa04a7de7dc77663c4f880c97625661a14bc
|
|
| MD5 |
9c812f1e456806b6fe0688d0f52dee6e
|
|
| BLAKE2b-256 |
c17aeefd8a06a00eeca59b098e57483597809ac02e3ab422125cb135d2715765
|
Provenance
The following attestation bundles were made for cg_feedback_helpers-1!1.0.4-py3-none-any.whl:
Publisher:
production_build.yml on CodeGra-de/CodeGra.de
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cg_feedback_helpers-1!1.0.4-py3-none-any.whl -
Subject digest:
a366d09409ae65228f37a38952befa04a7de7dc77663c4f880c97625661a14bc - Sigstore transparency entry: 834566692
- Sigstore integration time:
-
Permalink:
CodeGra-de/CodeGra.de@5ba70728af938b7dab06021ddd2a74895e0f9d33 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/CodeGra-de
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
production_build.yml@5ba70728af938b7dab06021ddd2a74895e0f9d33 -
Trigger Event:
push
-
Statement type: