No project description provided
Project description
pythonwhat
Verify Python code submissions and auto-generate meaningful feedback messages. Originally developed for Python exercises on DataCamp for so-called Submission Correctness Tests, but can also be used independently.
- New to teaching on DataCamp? Check out https://authoring.datacamp.com.
- To learn what SCTs are and how they work, visit this article specifically.
- For a complete overview of all functionality inside pythonwhat and articles about what to use when, consult https://pythonwhat.readthedocs.io.
Installation
# latest stable version from PyPi
pip install pythonwhat
# latest development version from GitHub
pip install git+https://github.com/datacamp/pythonwhat
Demo
To experiment locally, you can use setup_state() and write SCTs interactively.
The code throws an error when the underlying checks fail.
# make all checking functions available
from pythonwhat.test_exercise import prep_context
_, ctxt = prep_context()
globals().update(ctxt)
# initialize state with student and solution submission
from pythonwhat.local import setup_state
setup_state(stu_code = "x = 5", sol_code = "x = 4")
Ex().check_object('x')
# No error: x is defined in both student and solution process
Ex().check_object('x').has_equal_value()
# TestFail: Did you correctly define the variable `x`? Expected `4`, but got `5`.
# Debugging state
Ex()._state # access state object
dir(Ex()._state) # list all elements available in the state object
Ex()._state.student_code # access student_code of state object
To learn how to include an SCT in a DataCamp course, visit https://authoring.datacamp.com.
Run tests
pyenv local 3.5.2
pip install -r requirements.txt
pip install -e .
pytest
Bugs? Questions? Suggestions? Create an issue, or contact us!
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
pythonwhat-2.16.2.tar.gz
(50.6 kB
view details)
File details
Details for the file pythonwhat-2.16.2.tar.gz.
File metadata
- Download URL: pythonwhat-2.16.2.tar.gz
- Upload date:
- Size: 50.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db450dee3ee8d829779975e408a0761755d3ae3e2b58ad29f14655c347f5b521
|
|
| MD5 |
968f65c6b903675096e7128e8533b896
|
|
| BLAKE2b-256 |
d193201067ea0a1782c9ee10fa3cb3744489b5db905e6b38f4c7e90350c53d0e
|