abc-classroom.ok

class abcclassroom.ok.OKSuite(test_paths)[source]

Bases: object

run(global_environment, include_grade=True)[source]
class abcclassroom.ok.OKSuiteResult(grade, passed_tests, failed_tests, include_grade=True)[source]

Bases: object

Displayable result from running OKTests

result_template = <Template memory:7f0e17e86690>
class abcclassroom.ok.OKTest(name, tests)[source]

Bases: object

A single DocTest defined by OKPy. Instances of this class are callable. When called, it takes a global_environment dict, and returns a TestResult object. We only take a global_environment, not a local_environment. This makes tests not useful inside functions, methods or other scopes with local variables. This is a limitation of doctest, so we roll with it.

classmethod from_file(path)[source]

Parse a ok test file & return an OKTest

result_fail_template = <Template memory:7f0e17e51090>
result_pass_template = <Template memory:7f0e17e649d0>
run(global_environment)[source]
abcclassroom.ok.check('tests/q1.py')[source]

check(‘tests/q1.py’, globals()) Returns a TestResult object.

abcclassroom.ok.grade_notebook(notebook_path)[source]
abcclassroom.ok.run_doctest(name, doctest_string, global_environment)[source]

Run a single test with given global_environment. Returns (True, ‘’) if the doctest passes. Returns (False, failure_message) if the doctest fails.