def test_update_or_create_solution_cell(gradebook: Gradebook) -> None: # first test creating it gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc1 = gradebook.update_or_create_solution_cell('test1', 'p1', 'foo') assert gradebook.find_solution_cell('test1', 'p1', 'foo') == sc1 # now test finding/updating it sc2 = gradebook.update_or_create_solution_cell('test1', 'p1', 'foo') assert sc1 == sc2
def assignment(gradebook: Gradebook) -> Gradebook: gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=1, cell_type='code') gradebook.add_grade_cell('test2', 'p1', 'foo', max_score=2, cell_type='markdown') gradebook.add_solution_cell('solution1', 'p1', 'foo') gradebook.add_solution_cell('test2', 'p1', 'foo') gradebook.add_source_cell('test1', 'p1', 'foo', cell_type='code') gradebook.add_source_cell('test2', 'p1', 'foo', cell_type='markdown') gradebook.add_source_cell('solution1', 'p1', 'foo', cell_type='code') return gradebook
def assignmentWithTask(gradebook: Gradebook) -> Gradebook: for f in ['foo', 'foo2']: gradebook.add_assignment(f) for n in ['p1', 'p2']: gradebook.add_notebook(n, f) gradebook.add_solution_cell('solution1', n, f) gradebook.add_solution_cell('test2', n, f) gradebook.add_source_cell('test1', n, f, cell_type='code') gradebook.add_source_cell('test2', n, f, cell_type='markdown') gradebook.add_source_cell('solution1', n, f, cell_type='code') gradebook.add_grade_cell('grade_code1', n, f, cell_type='code', max_score=1) gradebook.add_grade_cell('grade_code2', n, f, cell_type='code', max_score=10) gradebook.add_grade_cell('grade_written1', n, f, cell_type='markdown', max_score=1) gradebook.add_grade_cell('grade_written2', n, f, cell_type='markdown', max_score=10) gradebook.add_task_cell('task1', n, f, cell_type='markdown', max_score=2) gradebook.add_task_cell('task2', n, f, cell_type='markdown', max_score=20) return gradebook