Skip to content

bentowner/pythonwhat

 
 

Repository files navigation

pythonwhat

Build Status codecov PyPI version Documentation Status

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.

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.

from pythonwhat.local import setup_state
s = setup_state(stu_code = "x = 5", sol_code = "x = 4")

s.check_object('x')
# No error: x is defined in both student and solution process

s.check_object('x').has_equal_value()
# TestFail: Did you correctly define the variable `x`? Expected `4`, but got `5`.

# Debugging state
s._state               # access state object
dir(s._state)          # list all attributes of the state object
s._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

Use Python 3.5

# install packages used in tests
pip install -r requirements.txt

# install pythonwhat
cd /path/to/pythonwhat
pip install -e .
pytest

Bugs? Questions? Suggestions? Create an issue, or contact us!

About

Functionality to write Submission Correctness Tests for Python exercises on DataCamp.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 99.9%
  • Makefile 0.1%