Skip to content
Snippets Groups Projects
Commit 178c3726 authored by tuhe's avatar tuhe
Browse files

updates to readme.md

parent 315fac5c
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,22 @@ instructor/cs101/deploy.py # A private file to deploy the tests ...@@ -39,6 +39,22 @@ instructor/cs101/deploy.py # A private file to deploy the tests
### The homework ### The homework
The homework is just any old python code you would give to the students. For instance: The homework is just any old python code you would give to the students. For instance:
```python ```python
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
reverse_list([1,2,3]) should return [3,2,1] (as a list).
"""
return list(reversed(mylist))
def add(a,b): #!f
""" Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
return a+b
if __name__ == "__main__":
# Example usage:
print(f"Your result of 2 + 2 = {add(2,2)}")
print(f"Reversing a small list", reverse_list([2,3,5,7]))
``` ```
### The test: ### The test:
...@@ -60,6 +76,28 @@ class Week1(unittest.TestCase): ...@@ -60,6 +76,28 @@ class Week1(unittest.TestCase):
``` ```
A number of tests can be collected into a `Report`, which will allow us to assign points to the tests and use the more advanced features of the framework later. A complete, minimal example: A number of tests can be collected into a `Report`, which will allow us to assign points to the tests and use the more advanced features of the framework later. A complete, minimal example:
```python ```python
import unittest
from unitgrade2.unitgrade2 import Report
from unitgrade2.unitgrade_helpers2 import evaluate_report_student
from cs101.homework1 import reverse_list, add
import cs101
class Week1(unittest.TestCase):
def test_add(self):
self.assertEqual(add(2,2), 4)
self.assertEqual(add(-100, 5), -95)
def test_reverse(self):
self.assertEqual(reverse_list([1,2,3]), [3,2,1])
class Report1(Report):
title = "CS 101 Report 1"
questions = [(Week1, 10)] # Include a single question for a total of 10 credits.
pack_imports = [cs101] # Include all .py files in this folder
if __name__ == "__main__":
# unittest.main(verbosity=2) # Uncomment to run everything as a regular unittest
evaluate_report_student(Report1())
``` ```
...@@ -67,6 +105,25 @@ A number of tests can be collected into a `Report`, which will allow us to assig ...@@ -67,6 +105,25 @@ A number of tests can be collected into a `Report`, which will allow us to assig
The above is all you need if you simply want to use the framework as a self-check: Students can run the code and see how well they did. The above is all you need if you simply want to use the framework as a self-check: Students can run the code and see how well they did.
In order to begin using the framework for evaluation we need to create a bit more structure. We do that by deploying the report class as follows: In order to begin using the framework for evaluation we need to create a bit more structure. We do that by deploying the report class as follows:
```python ```python
from cs101.report1 import Report1 #!s
from unitgrade_private2.hidden_create_files import setup_grade_file_report
import shutil, os
from snipper import snip_dir
# wd = os.path.dirname(__file__)
if __name__ == "__main__":
setup_grade_file_report(Report1)
# Deploy the files using snipper: https://gitlab.compute.dtu.dk/tuhe/snipper
snip_dir.snip_dir("./", "../../students/cs101", clean_destination_dir=True, exclude=['__pycache__', '*.token', 'deploy.py']) #!s
# For my own sake, copy the homework file to the other examples.
for f in ['../../../example_framework/instructor/cs102/homework1.py',
'../../../example_docker/instructor/cs103/homework1.py',
'../../../example_flat/instructor/cs101flat/homework1.py']:
shutil.copy('homework1.py', f)
``` ```
- The first line creates the `report1_grade.py` script and any additional data files needed by the tests (none in this case) - The first line creates the `report1_grade.py` script and any additional data files needed by the tests (none in this case)
......
...@@ -5,8 +5,8 @@ Unitgrade is an automatic report and exam evaluation framework that enables inst ...@@ -5,8 +5,8 @@ Unitgrade is an automatic report and exam evaluation framework that enables inst
Unitgrade is build on pythons `unittest` framework so that the tests can be specified in a familiar syntax and will integrate with any modern IDE. What it offers beyond `unittest` is the ability to collect tests in reports (for automatic evaluation) and an easy and 100% safe mechanism for verifying the students results and creating additional, hidden tests. A powerful cache system allows instructors to automatically create test-answers based on a working solution. Unitgrade is build on pythons `unittest` framework so that the tests can be specified in a familiar syntax and will integrate with any modern IDE. What it offers beyond `unittest` is the ability to collect tests in reports (for automatic evaluation) and an easy and 100% safe mechanism for verifying the students results and creating additional, hidden tests. A powerful cache system allows instructors to automatically create test-answers based on a working solution.
- 100% Python `unittest` compatible - 100% Python `unittest` compatible
- No external configuration files: Just write a `unittest` - No configuration files
- No unnatural limitations: Use any package or framework. If you can `unittest` it, it works. - No limitations: If you can `unittest` it, it works
- Tests are quick to run and will integrate with your IDE - Tests are quick to run and will integrate with your IDE
- Cache and hint-system makes tests easy to develop - Cache and hint-system makes tests easy to develop
- Granular security model: - Granular security model:
...@@ -39,7 +39,7 @@ instructor/cs101/deploy.py # A private file to deploy the tests ...@@ -39,7 +39,7 @@ instructor/cs101/deploy.py # A private file to deploy the tests
### The homework ### The homework
The homework is just any old python code you would give to the students. For instance: The homework is just any old python code you would give to the students. For instance:
```python ```python
{{example_simplest_instructor_homework1_py}} {{example_simplest_instructor_cs101_homework1_py}}
``` ```
### The test: ### The test:
The test consists of individual problems and a report-class. The tests themselves are just regular Unittest (we will see a slightly smarter idea in a moment). For instance: The test consists of individual problems and a report-class. The tests themselves are just regular Unittest (we will see a slightly smarter idea in a moment). For instance:
...@@ -60,14 +60,14 @@ class Week1(unittest.TestCase): ...@@ -60,14 +60,14 @@ class Week1(unittest.TestCase):
``` ```
A number of tests can be collected into a `Report`, which will allow us to assign points to the tests and use the more advanced features of the framework later. A complete, minimal example: A number of tests can be collected into a `Report`, which will allow us to assign points to the tests and use the more advanced features of the framework later. A complete, minimal example:
```python ```python
{{example_simplest_instructor_report1_py}} {{example_simplest_instructor_cs101_report1_py}}
``` ```
### Deployment ### Deployment
The above is all you need if you simply want to use the framework as a self-check: Students can run the code and see how well they did. The above is all you need if you simply want to use the framework as a self-check: Students can run the code and see how well they did.
In order to begin using the framework for evaluation we need to create a bit more structure. We do that by deploying the report class as follows: In order to begin using the framework for evaluation we need to create a bit more structure. We do that by deploying the report class as follows:
```python ```python
{{example_simplest_instructor_deploy_py}} {{example_simplest_instructor_cs101_deploy_py}}
``` ```
- The first line creates the `report1_grade.py` script and any additional data files needed by the tests (none in this case) - The first line creates the `report1_grade.py` script and any additional data files needed by the tests (none in this case)
- The second line set up the students directory (remember, we have included the solutions!) and remove the students solutions. You can check the results in the students folder. - The second line set up the students directory (remember, we have included the solutions!) and remove the students solutions. You can check the results in the students folder.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment