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

Updates for presentation

parent 3500606a
No related branches found
No related tags found
No related merge requests found
Showing
with 120 additions and 50 deletions
File added
......@@ -56,8 +56,12 @@
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Example: Problem 1 from the intro to python course}
\begin{itemize}
\item ldasf
\item Show install: Git pull repository, pip install unitgrade
\item Show files. Do simplest example first: Unittest (explicit) and problem script. Use the water height problem for this. Include various hints. Show the exercise description pdf.
\item Then show the grade file. Explain this is how they evaluate their homework.
\item Then show the unitgrade interface.
\end{itemize}
\end{frame}
\begin{frame}
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -2,12 +2,19 @@ from unitgrade_private import setup_grade_file_report
from snipper import snip_dir
from cpp_course.tests_ex6 import Week6
from cpp_exam.tests_exam import ExamMay2021
from intro_python.exam_complete import Exam2021
# def setup_grade_file_report_hidden(Exam2021, name_without_hidden=None):
# setup_grade_file_report(Exam2021) # Create report3_complete_grade.py which tests everything
if __name__ == "__main__":
from intro_python.exam import Exam2021
setup_grade_file_report(Week6, with_coverage=True, minify=False, obfuscate=False,bzip=True)
setup_grade_file_report(ExamMay2021, with_coverage=True, minify=False, obfuscate=False,bzip=True)
setup_grade_file_report(Exam2021, with_coverage=True, minify=False, obfuscate=False,bzip=True)
snip_dir("./", "../students", clean_destination_dir=True, exclude=['*.token', 'deploy.py'], output_dir="../Latex/output")
setup_grade_file_report(Exam2021, remove_hidden=True)
setup_grade_file_report(Week6)
setup_grade_file_report(ExamMay2021)
# setup_grade_file_report(Exam2021)
# student_directory = "../../students/cs103"
# snip_dir("./", student_directory, exclude=['*.token', 'deploy.py', 'report3_complete*.py', '.*']) # !s
snip_dir("./", "../students", clean_destination_dir=True, exclude=['*.token', 'deploy.py', '*_complete*'], output_dir="../Latex/output")
......@@ -11,15 +11,6 @@ class Q1_WaterHeight(UTestCase):
print("Water height computed to be", h, "should be", self.get_expected_test_value())
self.assertEqual(h, 3.0) # Check the height is 3.0
@hide
def test_water_height_hidden(self):
checks = [(120, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]),
(12, []), (14.2, [8.8]), (0, [0.8]),
(3, [0, 1, 2, 0, 0, 5.2, 6.5, 7.1, 0, 0, 0.1, 1, 2.9, 0.13, 0, 2, 0, 0]),
(0, [0, 5, 2, 0, 0, 5.2, 6.5, 7.1, 0, 0, 0.1, 1, 2.9, 0.13, 0, 1.2, 0, 1.2, 7.5, 0]),
(0, [0, 0, 2, 2.1, 2.4, 2.2, 2.5]), (18, [30, 1, 28.8]), (1, [0.5]), (2, [])]
for h0, r in checks:
self.assertEqualC(water_height(h0, r))
class Q2_AstronomicalSeason(UTestCase):
def test_seasons(self):
......@@ -27,10 +18,6 @@ class Q2_AstronomicalSeason(UTestCase):
print("Season was computed to be", season, "it was supposed to be", self.get_expected_test_value())
self.assertEqualC(season)
@hide
def test_seasons_hidden(self):
for d in ['27/12-1998', '21/06-2108', '08/05-1998', '07/08-1945', '22/12-1208', '19/03-2001', '23/09-2018', '21/06-2008','12/04-1964', '13/01-1900']:
self.assertEqualC(astronomical_season(d))
class Q3_TimeAngle(UTestCase):
......@@ -39,11 +26,6 @@ class Q3_TimeAngle(UTestCase):
print("Angle was", a, "it was supposed to be", self.get_expected_test_value())
self.assertEqualC(a)
@hide
def test_angle_extended(self):
for minute in [0, 15, 18, 20, 34, 50, 59]:
for hour in [0, 1, 5, 6, 10, 12]:
self.assertEqualC(time_angle(hour, minute))
class Q4_TicTacToe(UTestCase):
def test_tic_tac(self):
......@@ -54,21 +36,6 @@ class Q4_TicTacToe(UTestCase):
print("Score for board was", score, "it is supposed to be", self.get_expected_test_value())
self.assertEqualC(score)
@hide
def test_tic_tac_hidden(self):
boards = [[[1, 2, 0], [1, 2, 0], [1, 2, 0]],
[[1, 1, 1], [2, 1, 2], [2, 2, 1]],
[[2, 0, 1], [2, 1, 0], [0, 0, 2]],
[[1, 0, 2], [0, 1, 0], [2, 0, 1]],
[[2, 0, 1], [0, 2, 1], [0, 0, 1]],
[[0, 1, 0], [0, 1, 1], [2, 2, 2]],
[[1, 1, 2], [0, 2, 0], [2, 1, 0]],
[[1, 1, 1], [0, 2, 0], [0, 0, 0]],
[[1, 2, 1], [2, 1, 0], [2, 0, 1]],
[[0, 0, 0], [0, 1, 0], [0, 0, 0]],
[[2, 1, 1], [1, 1, 2], [2, 0, 0]]]
for board in boards:
self.assertEqualC(tictactoe(np.asarray(board)))
class Q5_StandardizeAddress(UTestCase):
......@@ -77,11 +44,6 @@ class Q5_StandardizeAddress(UTestCase):
print("Address computed to be", s, "was supposed to be", self.get_expected_test_value())
self.assertEqualC(s)
@hide
def test_standardize_address_hidden(self):
for address in ['Kongens_Lyngby_2800', '10000_Zagreb','43500 Daruvar','Egtved_6040','Vejle 7200', '02108_Boston',
'Pasadena_91001', '90001_Los_Angeles', 'San_Francisco_94016', 'Rio_de_Jainero_22775']:
self.assertEqualC(standardize_address(address))
......
import numpy as np
from unitgrade import UTestCase, Report, hide
import intro_python
from intro_python.problems import water_height, tictactoe, time_angle, astronomical_season, standardize_address
class Q1_WaterHeight(UTestCase):
def test1(self):
h0 = 5
r = np.array([4.5, 0, 1.5, 0, 0, 0.5, 1, 2, 5])
h = water_height(h0, r)
print("Water height computed to be", h, "should be", self.get_expected_test_value())
self.assertEqual(h, 3.0) # Check that the height is 3.0
@hide
def test_water_height_hidden(self):
checks = [(120, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]),
(12, []), (14.2, [8.8]), (0, [0.8]),
(3, [0, 1, 2, 0, 0, 5.2, 6.5, 7.1, 0, 0, 0.1, 1, 2.9, 0.13, 0, 2, 0, 0]),
(0, [0, 5, 2, 0, 0, 5.2, 6.5, 7.1, 0, 0, 0.1, 1, 2.9, 0.13, 0, 1.2, 0, 1.2, 7.5, 0]),
(0, [0, 0, 2, 2.1, 2.4, 2.2, 2.5]), (18, [30, 1, 28.8]), (1, [0.5]), (2, [])]
for h0, r in checks:
self.assertEqualC(water_height(h0, r))
class Q2_AstronomicalSeason(UTestCase):
def test_seasons(self):
season = astronomical_season('09/12-2020')
print("Season was computed to be", season, "it was supposed to be", self.get_expected_test_value())
self.assertEqualC(season)
@hide
def test_seasons_hidden(self):
for d in ['27/12-1998', '21/06-2108', '08/05-1998', '07/08-1945', '22/12-1208', '19/03-2001', '23/09-2018', '21/06-2008','12/04-1964', '13/01-1900']:
self.assertEqualC(astronomical_season(d))
class Q3_TimeAngle(UTestCase):
def test_angle(self):
a = time_angle(hour=8, minute=20)
print("Angle was", a, "it was supposed to be", self.get_expected_test_value())
self.assertEqualC(a)
@hide
def test_angle_extended(self):
for minute in [0, 15, 18, 20, 34, 50, 59]:
for hour in [0, 1, 5, 6, 10, 12]:
self.assertEqualC(time_angle(hour, minute))
class Q4_TicTacToe(UTestCase):
def test_tic_tac(self):
board = np.array([[2, 1, 1],
[1, 1, 2],
[2, 0, 0]])
score = tictactoe(board)
print("Score for board was", score, "it is supposed to be", self.get_expected_test_value())
self.assertEqualC(score)
@hide
def test_tic_tac_hidden(self):
boards = [[[1, 2, 0], [1, 2, 0], [1, 2, 0]], [[1, 1, 1], [2, 1, 2], [2, 2, 1]],
[[2, 0, 1], [2, 1, 0], [0, 0, 2]], [[1, 0, 2], [0, 1, 0], [2, 0, 1]],
[[2, 0, 1], [0, 2, 1], [0, 0, 1]], [[0, 1, 0], [0, 1, 1], [2, 2, 2]],
[[1, 1, 2], [0, 2, 0], [2, 1, 0]], [[1, 1, 1], [0, 2, 0], [0, 0, 0]],
[[1, 2, 1], [2, 1, 0], [2, 0, 1]], [[0, 0, 0], [0, 1, 0], [0, 0, 0]]]
for board in boards:
self.assertEqualC(tictactoe(np.asarray(board)))
class Q5_StandardizeAddress(UTestCase):
def test_standardize_address(self):
s = standardize_address('New York 10001')
print("Address computed to be", s, "was supposed to be", self.get_expected_test_value())
self.assertEqualC(s)
@hide
def test_standardize_address_hidden(self):
for address in ['Kongens_Lyngby_2800', '10000_Zagreb','43500 Daruvar','Egtved_6040','Vejle 7200', '02108_Boston',
'Pasadena_91001', '90001_Los_Angeles', 'San_Francisco_94016', 'Rio_de_Jainero_22775']:
self.assertEqualC(standardize_address(address))
class Exam2021(Report):
title = "Introduction to Python: Exam spring 2021"
pack_imports = [intro_python]
questions = [(Q1_WaterHeight, 20),
(Q2_AstronomicalSeason, 20),
(Q3_TimeAngle, 20),
(Q4_TicTacToe, 20),
(Q5_StandardizeAddress, 20)]
if __name__ == "__main__":
from unitgrade import evaluate_report_student
evaluate_report_student(Exam2021())
This diff is collapsed.
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment