Tools to help students write code.
Project description
Bakery Support Library
A collection of tools to help students write code, meant for the Python Bakery CS1 curriculum.
For now, mostly improved assertions.
Installation
Install from PyPi:
pip install bakery
Or install from: https://github.com/python-bakery/bakery-support-library
Examples
from bakery import assert_equal
def halve(number):
return number / 2
# Correctly handles floating points
assert_equal(halve(10), 5.0)
Output
This library will print a message to STDOUT if an assertion fails, and returns True/False. It does not raise an exception or print to STDERR.
Supported Types
Numbers: strictly compares numeric types, but allows floats to have imprecision, defaults to 4 places
Strings: can strictly compare types with exact_strings=True, but defaults to ignore whitespace on newlines and capitalization
Lists, Tuples: applies same rules to inner types as container types
Sets, Frozensets, Dictionary: checks that all elements are contained in both, in any order
Generators: functions like enumerate and .items() that produce generators are converted to lists and sets (as appropriate), then checked that their values match.
Other types should work as well, but require that the result of type match, and that x == y
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
Built Distribution
File details
Details for the file bakery-1.0.0.tar.gz
.
File metadata
- Download URL: bakery-1.0.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 850df636d16ee4b7e05e805bf7785f210c63ff6969d49b8596f0f19d8809ae2a |
|
MD5 | 8fcb1ada65e2a33d5c9ee00f4820b8c7 |
|
BLAKE2b-256 | cbc505ee26a56a007eb475927a90bd94de75526057e96aef242448870a335b66 |
File details
Details for the file bakery-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: bakery-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2b3441b1bd7eccf8dd6fc2734f6262df670eddf41eacd15d971bcb8f4beecf2 |
|
MD5 | f8c7ab9589a170e8372d4d920a391d90 |
|
BLAKE2b-256 | 7daab4fc22b4253d59bf447b854db5669b0e21350fa87af9f85c6ad732cb6503 |