diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..1cfab24 --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +
This module contains the error classes used in the framework.
Bases: Exception
src/gapper/core/errors.py
Extract the user traceback from the exception.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grader_path | str | None | The path to the grader file. | None |
src/gapper/core/errors.py
Extract the user traceback from the exception as a string.
Format the arguments of the error message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indent_num | int | The number of spaces to indent the message. | 0 |
src/gapper/core/errors.py
Bases: ErrorFormatter
Raised when an internal error occurs in the framework.
src/gapper/core/errors.py
Bases: ErrorFormatter
Raised when a submission has syntax errors.
src/gapper/core/errors.py
The JSON schemas for Gradescope's metadata.
dataclass
The JSON schema for Gradescope's assignment settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
due_date | datetime | The assignment's due date. | field(metadata=config(encoder=isoformat, decoder=fromisoformat, mm_field=DateTime(format='iso'))) |
group_size | Optional[int] | The maximum group size on a group assignment. | required |
group_submission | bool | Whether group submission is allowed. | required |
id | int | The assignment's ID. | required |
course_id | int | The course's ID. | required |
late_due_date | Optional[datetime] | The late due date, or None if late submission disallowed. | field(metadata=config(encoder=lambda : isoformat(s) if s else None, decoder=lambda : fromisoformat(s) if s else None, mm_field=DateTime(format='iso'))) |
release_date | datetime | The assignment's release date. | field(metadata=config(encoder=isoformat, decoder=fromisoformat, mm_field=DateTime(format='iso'))) |
title | str | The assignment's title. | required |
total_points | float | The total point value of the assignment. | field(metadata=config(encoder=str, decoder=float)) |
src/gapper/gradescope/datatypes/gradescope_meta.py
dataclass
The JSON schema for a 'user' (submitter) of a Gradescope assignment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email | str | The submitter's email. | required |
id | int | The submitter's ID. | required |
name | str | The submitter's name. | required |
src/gapper/gradescope/datatypes/gradescope_meta.py
dataclass
The JSON schema for a previous submission record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
submission_time | datetime | The time of the previous submission. | field(metadata=config(encoder=isoformat, decoder=fromisoformat, mm_field=DateTime(format='iso'))) |
score | float | The previous submission's score. | required |
results | GradescopeJson | The results.json file from the previous submission. | required |
src/gapper/gradescope/datatypes/gradescope_meta.py
dataclass
The JSON schema for Gradescope's submission metadata.
See Also https://gradescope-autograders.readthedocs.io/en/latest/submission_metadata/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id | int | The submission's ID. | required |
created_at | datetime | The time the submission was created. | field(metadata=config(encoder=isoformat, decoder=fromisoformat, mm_field=DateTime(format='iso'))) |
assignment | GradescopeAssignmentMetadata | The assignment's metadata. | required |
submission_method | Literal['upload', 'GitHub', 'Bitbucket'] | The submission method. | required |
users | List[GradescopeAssignmentUser] | The submitters' metadata. | required |
previous_submissions | List[GradescopePreviousSubmission] | The previous submissions' metadata. | required |
src/gapper/gradescope/datatypes/gradescope_meta.py
classmethod
Load the submission metadata from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to load the submission metadata from. | required |
src/gapper/gradescope/datatypes/gradescope_meta.py
The Gradescope grading output JSON schema.
dataclass
The JSON schema for Gradescope.
We currently don't support the leaderboard and extra_data features of the gradescope schema. Those are documented on the autograder documentation, here: https://gradescope-autograders.readthedocs.io/en/latest/specs/.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tests | list[GradescopeTestJson] | The tests for the problem. Required if no global score provided. | field(default_factory=list) |
score | Optional[float] | The overall score. Required if any test has no set score. | None |
execution_time | Optional[int] | The execution time of all the tests, in seconds. | None |
output | Optional[str] | The top-level, human-readable text output for all the problems. | None |
visibility | VisibilityType | The default visibility for each test. Overridden by test-specific settings. | 'visible' |
stdout_visibility | Optional[str] | Whether to show stdout for the tests. Same options as for visibility. | None |
src/gapper/gradescope/datatypes/gradescope_output.py
classmethod
from_test_results(
+ results: List[TestResult],
+ score: float,
+ save_path: Path | None = None,
+ **kwargs
+) -> GradescopeJson
+
Convert a list of test results to Gradescope JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results | List[TestResult] | The test results. | required |
score | float | The score obtained from the submission. | required |
save_path | Path | None | The path to save the Gradescope JSON to. | None |
kwargs | The keyword arguments to pass to the constructor. | {} |
src/gapper/gradescope/datatypes/gradescope_output.py
dataclass
The JSON schema for a single Test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | Optional[float] | The test's score. Required if no top-level score is set. | field(default=None) |
max_score | Optional[float] | The max score for the test. | field(default=None) |
name | Optional[str] | The test's name. | field(default=None) |
output | Optional[str] | Human-readable text output of the test. | field(default=None) |
tags | Optional[str] | Tags for the test. | field(default=None) |
visibility | VisibilityType | The test's visibility. "hidden", "visible", "after_due_date", "after_published" | field(default='visible') |
src/gapper/gradescope/datatypes/gradescope_output.py
Support for pipeline actions.
Bases: PipelineFactory
A pipeline action factory generating init calls.
src/gapper/core/pipeline_support.py
Bases: PipelineFactory
A pipeline action factory generating function calls.
src/gapper/core/pipeline_support.py
A pipeline action base class. All pipeline actions should inherit from this class.
src/gapper/core/pipeline_support.py
property
Whether to replace the piped object with the result of the pipeline action.
A pipeline base class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | The name of the attribute to be extracted from the piped object. | required |
_pipeline_replace | bool | Whether to replace the piped object with the result of the pipeline. | False |
args | The arguments to pass to the attribute. | () |
src/gapper/core/pipeline_support.py
A pipeline action factory base class. All pipeline action factories should inherit from this class.
The semantics of a pipeline action factory is to generate a pipeline action when called. That is
pipeline_factory = PipelineFactory(name)
+pipeline_action = pipeline_factory(*args, **kwargs)
+
+@test_case(
+ pipeline_action,
+ pipeline_factory(*args, **kwargs),
+)
+...
+
Attributes:
Name | Type | Description |
---|---|---|
ValueType | Type[PipelineBase] | The type of the pipeline action generated by the factory. |
src/gapper/core/pipeline_support.py
Bases: PipelineBase
A pipeline action factory generating property lookups.
src/gapper/core/pipeline_support.py
@problem
-- Problem
This module defines the Problem class, which is the abstract representation of a assignment problem.
Bases: ModuleLoader
, Generic[ProbInputType, ProbOutputType]
A abstract representation of a assignment problem.
src/gapper/core/problem.py
50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 |
|
property
The expected name of the submission.
__init__(
+ solution: Callable[ProbInputType, ProbOutputType],
+ *,
+ config: ProblemConfig
+) -> None
+
Create a problem object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
solution | Callable[ProbInputType, ProbOutputType] | The solution to the problem. | required |
config | ProblemConfig | The configuration of the problem. | required |
src/gapper/core/problem.py
Add a post test to the problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
post_test | PostTest | The post test to add. | required |
src/gapper/core/problem.py
Add a test parameter to the problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
test_param | TestParam | The test parameter to add. | required |
src/gapper/core/problem.py
classmethod
Load a problem from a path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to load the problem from. If the path is a directory, it will be searched recursively. But only one problem can be defined in a directory. | required |
src/gapper/core/problem.py
dataclass
Problem configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
check_stdout | bool | Whether to check the stdout of the solution. | False |
mock_input | bool | Whether to mock the input of the solution. | False |
captured_context | Iterable[str] | The context to capture from the submission. | () |
is_script | bool | Whether this problem is a script. | False |
src/gapper/core/problem.py
problem(
+ *,
+ is_script: bool = False,
+ check_stdout: Optional[bool] = None,
+ mock_input: Optional[bool] = None,
+ context: Iterable[str] = ()
+) -> Callable[
+ [Callable[ProbInputType, ProbOutputType]],
+ Problem[ProbInputType, ProbOutputType],
+]
+
Create a problem object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_script | bool | Whether this problem is a script. This cannot coexist with check_stdout or mock_input. | False |
check_stdout | Optional[bool] | Whether to check the stdout of the solution. | None |
mock_input | Optional[bool] | Whether to mock the input of the solution. | None |
context | Iterable[str] | The context to capture from the submission. | () |
src/gapper/core/problem.py
ResultSynthesizer
post_test
is an alias of PostTest
. That is
from gapper import post_test
+from gapper.core.result_synthesizer import PostTest
+
+assert post_test is PostTest
+
This module contains a class to synthesize the results from a tester.
A decorator for post tests. Will be used as @post_test() decorator.
src/gapper/core/result_synthesizer.py
Add the post test to the problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
problem | Problem | The problem to add the post test to. | required |
A decorator for specifying post tests. Will be used as @post_test().
from gapper import post_test, problem
+
+@post_test()
+@problem()
+...
+
Parameters:
Name | Type | Description | Default |
---|---|---|---|
post_test_fn | PostTestFn | The function to be called after all tests are run. | required |
as_test_case | bool | Whether to treat the post test as a test case. | True |
src/gapper/core/result_synthesizer.py
src/gapper/core/result_synthesizer.py
59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 |
|
__init__(
+ *,
+ results: List[TestResult] = None,
+ post_tests: List[PostTest] = None,
+ metadata: GradescopeSubmissionMetadata | None = None,
+ total_score: float | None = None
+) -> None
+
A class to synthesize the results from a tester.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results | List[TestResult] | The results of the tester. | None |
post_tests | List[PostTest] | The post tests to run after all tests are run. | None |
metadata | GradescopeSubmissionMetadata | None | The metadata of the submission. | None |
total_score | float | None | The total score of the assignment. | None |
src/gapper/core/result_synthesizer.py
Run the post tests.
src/gapper/core/result_synthesizer.py
Synthesize the score from the results.
staticmethod
Synthesize the score from the results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results | List[TestResult] | The results to synthesize the score from. | required |
total_score | float | The total score of the assignment. | required |
src/gapper/core/result_synthesizer.py
130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 |
|
Convert the results to Gradescope JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path | Path | None | The path to save the Gradescope JSON to. | None |
kwargs | The keyword arguments to pass to the GradescopeJson constructor. | {} |
src/gapper/core/result_synthesizer.py
TestCaseWrapper
This module contains the TestCaseWrapper class, and related help definitions.
Bases: TestCase
A wrapper for the unittest.TestCase class.
This serves as a proxy for the testing process to get useful information about the test and functions for testing
src/gapper/core/unittest_wrapper.py
63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 |
|
Create a test case wrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
test_param | TestParam | The test parameter to be used in testing. | required |
problem | Problem | The problem definition to be used in testing. | required |
src/gapper/core/unittest_wrapper.py
Check if the test passes against the gap_expect and gap_expect_stdout.
Returns:
Type | Description |
---|---|
Tuple[bool, Any, str] | None | True if the test passes, False if the test fails, None if the test is skipped. |
src/gapper/core/unittest_wrapper.py
Load the submission context into the test case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | ContextManager | The context to load. | required |
src/gapper/core/unittest_wrapper.py
Load the submission metadata into the test case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata | GradescopeSubmissionMetadata | None | The metadata to load. The metadata could be None. | required |
src/gapper/core/unittest_wrapper.py
Run the test on the submission.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
submission | Any | The submission to be tested. | required |
result | TestResult | The result object to be used and written to. | required |
Returns:
Type | Description |
---|---|
TestResult | The result object passed to this method. |
src/gapper/core/unittest_wrapper.py
TestParam
and TestParamBundle
test_case
and param
are aliases of TestParam
, and test_cases
is a alias of TestParamBundle
respectively.
from gapper import test_case, param
+from gapper.core.test_parameter import TestParam
+
+assert param is TestParam
+assert test_case is TestParam
+
from gapper import test_cases
+from gapper.core.test_parameter import TestParamBundle
+
+assert test_cases is TestParamBundle
+
This module contains the test case (parameter) support classes and functions.
Bases: Enum
Reserved keywords for gap.
src/gapper/core/test_parameter.py
A class to extract the gap test parameter.
src/gapper/core/test_parameter.py
79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 |
|
Initialize the gap test parameter.
staticmethod
Check if there are any residue gap kwargs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs | Dict[str, Any] | The keyword arguments to check. | required |
src/gapper/core/test_parameter.py
Update the gap kwargs with a set of kwargs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs | Any | The keyword arguments to be pushed into the param_info. | {} |
Bases: ParamExtractor
A class to represent a test case (parameter). Will be used as @test_case() decorator.
Attributes:
Name | Type | Description |
---|---|---|
pipeline | partial[TestParam] | specify test case using pipeline actions. |
src/gapper/core/test_parameter.py
146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 |
|
Initialize the gap test parameter (test_case).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args | Any | The arguments for the test parameter. | () |
kwargs | Any | The keyword arguments for the test parameter, including kwargs. | {} |
src/gapper/core/test_parameter.py
classmethod
Bind the gap kwargs to the test case.
Format the test parameter.
src/gapper/core/test_parameter.py
Register the test parameter to the problem.
A class to represent a test parameter bundle (test_cases). Will be used as @test_cases() decorator.
Attributes:
Name | Type | Description |
---|---|---|
params | partial[TestParamBundle] | specify test cases using parameters. |
param_iter | partial[TestParamBundle] | specify test cases using parameter iterators. |
singular_params | partial[TestParamBundle] | specify test cases using singular parameters. |
singular_param_iter | partial[TestParamBundle] | specify test cases using singular parameter iterators. |
zip | partial[TestParamBundle] | specify test cases using zip. |
product | partial[TestParamBundle] | specify test cases using product. |
src/gapper/core/test_parameter.py
302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 |
|
__call__(
+ prob: Problem[ProbInputType, ProbOutputType]
+) -> Problem[ProbInputType, ProbOutputType]
+
Generate the test cases as a decorator.
src/gapper/core/test_parameter.py
__init__(
+ *args: Iterable[Any] | Any,
+ gap_product: bool = False,
+ gap_zip: bool = False,
+ gap_params: bool = False,
+ gap_param_iter: bool = False,
+ gap_singular_params: bool = False,
+ gap_singular_param_iter: bool = False,
+ **kwargs: Any
+) -> None
+
Initialize the test parameter bundle (test_cases).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args | Iterable[Any] | Any | The arguments for the test parameter bundle. | () |
gap_product | bool | Whether to take the cartesian product of the arguments. | False |
gap_zip | bool | Whether to zip the arguments. | False |
gap_params | bool | Whether to parse the arguments as parameters. | False |
gap_param_iter | bool | Whether to parse the argument as parameter iterators. | False |
gap_singular_params | bool | Whether to parse the arguments as singular parameters. | False |
gap_singular_param_iter | bool | Whether to parse the arguments as singular parameter iterators. | False |
kwargs | Any | The keyword arguments for the test parameter bundle. | {} |
src/gapper/core/test_parameter.py
384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 |
|
staticmethod
Add gap_kwargs to the finalized parameters.
src/gapper/core/test_parameter.py
classmethod
Bind the gap kwargs to the test cases.
staticmethod
Parse the parameters for param sequence.
src/gapper/core/test_parameter.py
staticmethod
Parse the parameters for param sequence.
src/gapper/core/test_parameter.py
staticmethod
parse_zip_or_product(
+ *args: Iterable[Any],
+ gap_product: bool = False,
+ gap_zip: bool = False,
+ **kwargs: Any
+) -> List[TestParam]
+
Parse parameters for zip or product.
src/gapper/core/test_parameter.py
TestResult
-- Test Result ProxyThis module contains the test result class.
dataclass
src/gapper/core/test_result.py
13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 |
|
property
The name of the test, with the default name prepended if the name is unset.
property
The description output of the test, with the score and max score appended if set.
Add a description to the test.
New descriptions are added as newlines to the end of the existing descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detail | str | The description to add. | () |
src/gapper/core/test_result.py
Add an error to the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error | ErrorFormatter | The error to add. | required |
set_failed | bool | Whether to set the pass status to failed. | True |
src/gapper/core/test_result.py
Set the description of the test.
This overrides all the existing descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detail | Iterable[str] | The description to set. | required |
src/gapper/core/test_result.py
Set the extra points of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | float | None | The extra points of this test case to set. | required |
Set the hidden status of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hidden | bool | Whether the test is hidden. | required |
Set the max score of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_score | float | None | The max score of this test case to set. | required |
Set the pass status of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
status | PassStateType | The pass status to set. | required |
Set the score of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | float | The score to set. | required |
Set the weight of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weight | int | None | The weight of this test case to set. | required |
Tester
This module contains the definition of the tester class.
Bases: ModuleLoader
, Generic[ProbInputType, ProbOutputType]
src/gapper/core/tester.py
42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 |
|
property
writable
The problem to be tested.
property
The context of captured from the submission.
Create a tester object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
problem | Problem[ProbInputType, ProbOutputType] | The problem to be tested. | required |
src/gapper/core/tester.py
Check if the context is complete against what's required in the problem.
src/gapper/core/tester.py
Dump the tester to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | str | The path to dump the tester to. | required |
src/gapper/core/tester.py
classmethod
Load a tester from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to load the tester from. | required |
src/gapper/core/tester.py
Load the context from a module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
md | ModuleType | The module to load the context from. | required |
Raises:
Type | Description |
---|---|
MultipleContextValueError | If multiple context values are found. |
src/gapper/core/tester.py
Load the submission from a path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to load the submission from. If the path is a directory, it will be searched recursively. | required |
Raises:
Type | Description |
---|---|
NoSubmissionError | If no submission is found. |
MultipleSubmissionError | If multiple submissions are found. |
src/gapper/core/tester.py
Run the tests.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata | GradescopeSubmissionMetadata | None | The metadata of the submission, which could be None. | None |
src/gapper/core/tester.py
{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Ha=/["'&<>]/;Un.exports=$a;function $a(e){var t=""+e,r=Ha.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i