Skip to main content

Pydagogy

Pydagogy is a Python library for automated code checking in online courses.

Content developers create the tests with hints, solutions, and other messaging. Students import the tests and run them in their exercise code to get feedback.

Usage

Content developers create tests by subclassing pydagogy.tests.BaseTest, or using one of the built-in tests like ValueTest. There are assert functions available that automatically print out messages when tests fail. This way you can have multiple checks within a test without breaking execution.

For example, you could create a test that checks for string equality.

import pydagogy as pgy

class MyTest(pgy.tests.BaseTest):
    def check(self, value):
        expected = "example string"
        message =  "Sorry, your result doesn't look correct."
        if pgy.assert_true(value == expected, message):
            self.success

# Create the test and add feedback for students
test_p1 = MyTest()
test_p1.hint = "Example hint text"
test_p1.solution = "Example solution text"
test_p1.success = "Nicely done!"

This test is imported into the student exercise code.

from test_file import test_p1

# students do something to generate a string
out_string = some_func()

test_p1.check(out_string)

# Uncomment the line below to see a hint
# test_p1.hint

# Uncomment the line below to see the solution
# test_p1.solution

The check function will print out the success message ("Nicely done!" in this example), if the student's string is the same as the expected string. Otherwise, it will print out the fail messsage.

Students can look at the hint and solution if they want, uncommenting those lines will print out the text.

Dependencies

Python 3.6 because f-strings. Seriously, update to 3.6 just for f-strings. You'll thank me.

Release files for pydagogy 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydagogy 0.1
File Size Uploaded
pydagogy-0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydagogy 0.1
File Interpreter ABI Platform
pydagogy-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / pydagogy-0.1.tar.gz

Download URL pydagogy-0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bf1d7ae4a056532927ef7ac65e508dcc3f348587bfdff1ec1d49d6636658afe5
BLAKE2b-256 checksum
How to use checksums
cbf8e0a1472c74495e308e83eeff0851c48f467a5b77e073adad82450b213539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.24.0 setuptools/51.3.3 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.6.12

Release files / pydagogy-0.1-py3-none-any.whl

Download URL pydagogy-0.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0598344ef556a2110a0233a0b7739611125d14bba50dfb9a5b91711220b2049
BLAKE2b-256 checksum
How to use checksums
30400b4a6ee075cc528abeb248b4319739bd09338b3c32cb726d8f0315c334ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.24.0 setuptools/51.3.3 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.6.12

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page