Nowledgeable exercice check
This module let student check their answers outside nowledgeable, anywhere.
Allows exercices to be run outside the nowledgeable application.
Allow also testing complex applications
Contain also the python exercice unit framework
installation
pip3 install nowledgeable
usage
Exercice checking
Run the following in an exercice containing an exercice with the exercice.yaml specification
nowledgeable run-checks
or
nowledgeable run-checks /path/to/exercice.yaml
Watching for file update and reruning files automatically
nowledgeable watch
using the unit testing library
from python_utils.utils import AnswerTester
tester = AnswerTester() #singleton pattern
## add assertions
tester.print_test_output()
Exemples
imagine you have the following wording :
"Code the function multiply_by_two(x) return 2 * x for each x"
You can use compare_function.
for that you need to :
- code the proper function
- specify a test_inputs variables which will be fed to the student function and the good one.
def solution(x): return 2 * x
tester = AnswerTester()
test_inputs = [
[3], # la fonction sera testée avec l'argument x=3
[-2],# la fonction sera testée avec l'argument x=-2
[random.randint(-3, 3)] #la fonction sera testée avec un x aléatoire entre -3 et 3
]
tester.compare_functions("nom test", multiply_by_two, solution, test_inputs, "message")
result_status = tester.get_test_output()
result = tester.get_test_output() #A la fin on demande de générer le json
Metadata
Release files for nowledgeable 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nowledgeable-0.1.12.tar.gz | 39.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nowledgeable-0.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 84.9 kB
Release files / nowledgeable-0.1.12.tar.gz
| Download URL | nowledgeable-0.1.12.tar.gz |
|---|---|
| Size | 39.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7f7c50117eff39f88eb012ea903d97244dbeb02a1c5422a68c04f989d6a0379
|
|
BLAKE2b-256 checksum How to use checksums |
b64fdfdac2410b7ba9dd35ebd9114cf56c6f9492be688b90d4bab68650a9ad56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / nowledgeable-0.1.12-py3-none-any.whl
| Download URL | nowledgeable-0.1.12-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a0b851c316f26934094bbdf99bbe5122da5f5d5de03d2eb59404f41807c7bc6
|
|
BLAKE2b-256 checksum How to use checksums |
90aaa1b616a2e269f6807fa6c7c566ad9c75ecd11e117eec6af9c4ca5a169c1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|