Python的提交正确性测试
项目描述
蟒蛇什么
验证 Python 代码提交并自动生成有意义的反馈消息。最初是为 DataCamp 上的 Python 练习开发的,用于所谓的提交正确性测试,但也可以独立使用。
- 刚开始使用 DataCamp 教学?查看https://instructor-support.datacamp.com
- 要了解 SCT 是什么以及它们如何工作,请专门访问这篇文章。
- 有关 pythonwhat 中所有功能的完整概述以及有关何时使用的文章,请参阅https://pythonwhat.readthedocs.io。
安装
# latest stable version from PyPi
pip install pythonwhat
# latest development version from GitHub
pip install git+https://github.com/datacamp/pythonwhat
演示
要在本地进行实验,您可以setup_state()交互地使用和编写 SCT。当基础检查失败时,代码会引发错误。
# 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.test_exercise 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
要了解如何在 DataCamp 课程中加入 SCT,请访问https://instructor-support.datacamp.com。
运行测试
pyenv local 3.9.6
pip3.9 install -r requirements.txt
pip3.9 install -e .
pytest
贡献
执照
项目详情
关
tcs_pythonwhat -2.24.21.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | a2f6d3242a4e86f5a29fd53771475371f155cfc8ab80c22b50d519e46e7c9964 |
|
| MD5 | 962858dc769135178d05e03d283f0462 |
|
| 布莱克2-256 | f42b02e2b2d3fcff70d05219a18e138f0d9aa10ad7d5a07716aa0c4390a3d15f |