Auto checker
Project description
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
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
nowledgeable-0.1.7.tar.gz
(37.8 kB
view hashes)
Built Distribution
Close
Hashes for nowledgeable-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d03c17b26c4fb96989efa98489033e2e9154a03d0799afb2f8d5e4631c3fe714 |
|
MD5 | 8fa3e85361690e896c9c3a66d9b68479 |
|
BLAKE2b-256 | a19ed8c7789dff30f16df8f7c84d5a2873971acfb189bc66e35975c2bcc3278f |