Handle grouped test cases + auto-retry if out of tokens #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem?
Sometimes, when you're working on a question with partial scores, it is very likely that the test cases are made into groups. The current implementation hinders whether we fail the test case group(s) or not.
Here's an example I took while working on this question and this question. Assume that
ktcli <problem_id>
is my own command alias to run the submission script along with<problem_id>.py
attached somewhere.Normally, if you fail a testcase, the judging will stop, as shown below.
For those with testcase groups, if you fail a testcase, instead of ending the entire judgement, there can be multiple behaviors. Usually, it will simply move on to the next testcase group, until there is none left. On other occassions, it will keep judging the next test cases anyways.
Therefore, we can't tell if we're failing a particular test case or not until we know it stops judging. In fact, we can still get partially accepted with these mistakes existing, as shown below (I did not get 100 points for this).
So what does this PR do?
Introduce colours (and scores too! #44)
With colours, we can finally tell these testcases apart. Here are two scenarios: when the judging is in progress, and when it's done.
Judging in progress
Yellow question mark for a nice touch 😄
Single group (default)
Grouped testcases
AC verdict
Single group (default)
Grouped testcases
Non-AC verdict
Small addition: auto-retry for out-of-tokens scenario
I personally find myself too lazy to keep running the script whenever I ran out of tokens. So I made sure that the script auto-retries until it has a token again.
Here's a reference to what originally happens when you're out of tokens.
This PR will ensure when the same thing happens, it will simply wait until the time is right and then does the usual behavior.