Skip to content

Commit 7f586a1

Browse files
authored
Restore pre-v6 R partial credit behavior (#936)
* fix grading image builds due to mamba changes * restore partial credit behavior for R assignments * remove pritn
1 parent 4bd9dbb commit 7f586a1

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
**v6.1.4 (unreleased):**
4+
5+
* Fixed R assignment grading to assign partial credit for all test cases (restoring an unintended change to pre-v6 behavior) per [#935](https://github.com/ucbds-infra/otter-grader/issues/935)
6+
37
**v6.1.3:**
48

59
* Updated grading image build scripts to fix breakages caused by changes to Mamba

otter/test_files/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def from_ottr_json(cls, ottr_output: dict[str, Any]) -> "GradingResults":
180180
name=os.path.splitext(os.path.basename(tfr["filename"]))[0],
181181
path=tfr["filename"],
182182
test_cases=test_cases,
183+
all_or_nothing=False,
183184
)
184185
test_file.test_case_results = test_case_results
185186

test/test_run/test_integration.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,31 @@ def perform_test(rmd, expected_results, error=None, **kwargs):
540540
error=error_message,
541541
)
542542

543+
# test that partial credit is awarded
544+
pc_rmd = re.sub(r"^x <- 2$", "x <- 50", orig_rmd, flags=re.MULTILINE)
545+
expected_results = copy.deepcopy(expected_rmd_results)
546+
expected_results["tests"][1]["score"] = 2
547+
expected_results["tests"][1]["output"] = dedent(
548+
"""\
549+
q1 results:
550+
q1 - 1 result:
551+
552+
q1 - 2 result:
553+
554+
q1 - 3 result:
555+
`x` not equal to 2.
556+
1/1 mismatches
557+
[1] 50 - 2 == 48
558+
559+
q1d result:
560+
as.character(x) not equal to "2".
561+
1/1 mismatches
562+
x[1]: "50"
563+
y[1]: "2"
564+
""".rstrip()
565+
)
566+
perform_test(pc_rmd, expected_results)
567+
543568
finally:
544569
delete_paths([rmd_path])
545570
with open(rmd_path, "w+") as f:

0 commit comments

Comments
 (0)