Comments (5)
So it's been a long time since this issue was opened but I think I've finally figured out a good schematic for a new test case format that relies on more traditional unit test-like formatting.
I'm thinking of a format that looks something like this:
from otter.test_files import test_case
name = "q1"
points = None
@test_case()
def test_sieve_1(env):
assert env["sieve"](1) == set()
@test_case(name="q1b")
def test_sieve_2(sieve):
assert sieve(2) == {2}
@test_case(name="q1c")
def test_sieve_3(sieve, env):
assert sieve(3) == {2, 3}
assert env["a"] == 1
@test_case(name="q1d", hidden=True)
def test_sieve_4(env):
assert env["sieve"](20) == {2, 3, 5, 7, 11, 13, 17, 19}
@test_case(name="q1e", points=1, hidden=True)
def test_sieve_5(env):
assert env["sieve"](100) == {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89, 97}
The idea is similar to pytest, where a test fails if an exception is raised, and passes otherwise. The decorator is an object provided by Otter to store the test case metadata, and the student's global environment (or specific elements in it) are accessed through arguments to the test case functions.
from otter-grader.
Wow, this is really interesting, thanks! There have been some conversations recently about the limitations of the current testing format/framework for OK autograders (like what came up at the workshop) and so changing the testing format is something we might consider for a future release (v2?) as OkPy becomes more of a legacy solution and more classes get ported away from it.
Let's keep this thread open as a forum for considering this and other unit-testing frameworks as a method for writing Otter's tests!
from otter-grader.
π I bet they'd be excited to see testbook used in grading as well!
from otter-grader.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from otter-grader.
Implemeted in #376. This feature will be included in Otter v4.
from otter-grader.
Related Issues (20)
- Hanging on ipywidgets cell HOT 3
- Add validation to otter assign that errors when cell/line magics are present in test cells
- Exporting pdf's to other gradescope assignments fails when students add in external files HOT 3
- ottr::export fails when pdf canβt be generated HOT 16
- ottr::export force_save isn't working HOT 14
- Blank tests summary when exporting student's notebook from tutorial HOT 1
- Remove support for nbconvert<6
- Provide a way to remove the conda defaults channel from the environment.yml file HOT 1
- Migrate PDF via HTML exporter from wkhtmltopdf to nbconvert's webpdf exporter
- Enable PDF via HTML exports in grading containers
- Running the otter-grader tutorial HOT 4
- Convert python notebook to a python script file HOT 2
- Otter run --debug flag does not work
- Gradescope does tests in a different order than in the jupyter notebook HOT 2
- Otter Generate should deduplicate user-specified requirements with otter-provided ones
- Empty assignment config results in AttributeError
- Strip type annotations from generated test files in Otter Assign
- Add process for retrieving the executed notebook to docs
- Add metadata to last solution cell to run hidden test cases if question has no public tests
- Add manually graded questions within the same gradescope assignment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otter-grader.