The Primary Instance of a course is a special nomination that can be given to one instance of each course at a time. It gives the instance a special URL that has the course name slug twice instead of having the course name slug followed by the instance name slug. The main use case is to be able to get a shareable link that will always point to the most recent course instance. This way links to Lovelace courses from other sites will not become obsolete whenever a new course instance is created.
PySenpai Message Reference¶
This page of the guide describes all messages that are built into PySenpai and its extensions. It should be useful for seeing what PySenpai tells the student by default in each situation. It also includes information about what values are given to each message as format keyword arguments. Messages are presented in test sequence order.
Format parameters marked as DEPRECATED are retained but should not be used in new checkers. This is mostly because they provide information that is included in other messages by default in the current version. They are retained to avoid breaking existing checkers that may have custom messages relying on the existence of these parameters.
Core Messages¶
Messages that are defined in the core module of PySenpai.
Import Messages¶
These are the messages used by
load_module
.LoadingModule¶
This message is printed into the evaluation log at the start of the module loading process.
- default (en):
"Loading module {name} for evaluation..."
- default (fi):
"Ladataan moduuli {name} arvioitavaksi..."
- available keyword arguments:
- name: Name of the student module
MissingFileExtension¶
Used if the filename of the returned file does not have the .py file extension.
- default (en):
"The file is missing the .py extension, which is required of Python code files."
- default (fi):
"Tiedostosta puuttuu .py-pääte, joka tulisi olla kaikissa Python-tiedostoissa."
- available keyword arguments
BadModuleName¶
Used if the name contains characters that are not allowed in Python module names (i.e. makes it unimportable with a normal import statement).
- default (en):
"The filename contained unsupported characters.\nOnly letters of the English alphabet, numbers and underscore are allowed."
- default (fi):
"Tiedoston nimessä oli merkkejä joiden takia tarkistin ei pysty sitä avaamaan. Käytä vain englanninkielisiä aakkosia, numeroita ja alaviivaa nimessä."
- available keyword arguments:
SystemModuleName¶
Used if the student returned a module with the same name as a Python standard library module.
- default (en):
"The filename {name} collides with a system module. Rename your file."
- default (fi):
"Palautetun moduulin nimi {name} on sama kuin järjestelmämoduulin. Vaihda tiedoston nimi."
- available keyword arguments:
- name: Name of the student module
GenericErrorMsg¶
Used if no exception-specific message is found.
- default (en):
"An error occurred while importing the module.\n{ename}: {emsg}"
- default (fi):
"Ohjelmaa ladattaessa tapahtui poikkeus.\n{ename}: {emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
ImportError¶
Used if there's an import error while trying to load the student module.
- default (en):
"The code file was not found or imports inside it caused an ImportError.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelmaa ei löytynyt tai sen lataamisessa tapahtui ImportError.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
EOFError¶
Used if there's an EOF error while trying to load the student module. The error message is written from the perspective that the most likely cause is the use of input in a way that goes against the exercise description.
- default (en):
"An EOFError occurred while importing the module. The most likely cause is calling input too many times.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelman suorituksessa tapahtui EOFError. Todennäköisin syy on input-funktion kutsuminen liian monta kertaa.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
SystemExit¶
Used if the student code has a forced exit (i.e. exit, sys.exit or similar).
- default (en):
"The program was terminated through the use of:\nquit(), exit(), sys.exit(), raise SystemExit (etc.)\nYour program needs to be implemented such a way that it doesn't need any of these."
- default (fi):
"Koodin suoritus on lopetettu väärin käyttämällä jotain seuraavista:\nquit(), exit(), sys.exit(), raise SystemExit\nToteuta ohjelma siten, että näille tai vastaaville keinoille ei ole tarvetta!"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
SyntaxError¶
Used if the student module cannot be imported due to a syntax error. Friendly reminds the student to test the code on their own computer.
- default (en):
"Your code included syntax errors. Do not use the checking program as a Python interpreter!\nYou should find all the errors in your code by running it in a shell as it provides more accurate information of what went wrong.\nSubmit your code for testing only after it runs on your computer!"
- default (fi):
"Koodi sisälsi syntaksivirheitä. Älä käytä tarkistusta Python-tulkkina!\nKorjaa koodisi virheet omalla koneella suorittamalla, jolloin saat tarkkaa tietoa missä ja millaisia virheet ovat.\nPalauta koodisi vasta kun saat sen komentorivillä toimimaan alusta loppuun!"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
IndentationError¶
Used if the student module cannot be imported due to an indentation error. Friendly reminds the student to test the code on their own computer.
- default (en):
"Your code included indentation errors. Do not use the checking program as a Python interpreter!\nYou should find all the errors in your code by running it in a shell as it provides more accurate information of what went wrong.\nSubmit your code for testing only after it runs on your computer!"
- default (fi):
"Koodi sisälsi sisennysvirheitä. Älä käytä tarkistusta Python-tulkkina!\nKorjaa koodisi virheet omalla koneella suorittamalla, jolloin saat tarkkaa tietoa missä ja millaisia virheet ovat.\nPalauta koodisi vasta kun saat sen komentorivillä toimimaan alusta loppuun!"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
NameError¶
Used if there's a name error when importing the student module. The default message assumes that this is due to handling control structures poorly. At least historically this is most commonly encountered when the student code doesn't take "do nothing" inputs into account properly.
- default (en):
"Your program contains an execution path that tries to access an undefined variable.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelmassa on suorituspolku, jossa luetaan muuttujaa jota ei ole vielä luotu\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
PrintExcLine¶
Used whenever there is an exception while loading the module. Prints the line number and line content of the last line that was involved in the exception within the student's code file. Shows a question mark as the line number if PySenpai is unable to find any line within the student code from the stack trace of the exception.
- default (en):
"Caused by line {lineno}:\n{line}"
- default (fi):
"Aiheutui rivistä {lineno}:\n{line}"
- available keyword arguments:
- lineno: line number within the student module
- line: content of the line
PrintInputVector¶
Used to show the inputs to the student if there was an exception while importing the code. Is not shown if the input vector is empty.
- default (en):
"While using inputs:\n{inputs}"
- default (fi):
"Käytettiin syötteitä:\n{inputs}"
- available keyword arguments:
- inputs: list of inputs, filtered through the inputs presenter
DisallowedOutput¶
Used if the
allow_ouput
keyword argument to load_module
is set to False (default is True) and the student code prints anything into stdout. - default (en):
"Your main program produced output, even though it's been specifically unallowed for this assignment. Please make sure your program doesn't execute extra code when being imported. Here is your program's output:\n{output}"
- default (fi):
"Pääohjelmasi tuotti tulosteita, vaikka sen ei pitäisi. Muista varmistaa, että ohjelmasi ei suorita ylimääräisiä koodiriviejä kun se importataan. Ohjelma tulosti seuraavaa:\n{output}"
- available keyword arguments:
- output: The full output that should not have been
PrintStudentOutput¶
Shows the full output of the student code if
hide_output
keyword argument to load_module
is set to False (default is True). - default (en):
"Your program's output while loading:\n{output}"
- default (fi):
"Ohjelmasi tuloste ladatessa:\n{output}"
- available keyword arguments:
- output: The full output that should not have been
Function Test Messages¶
These messages are used by
test_function
FunctionName¶
Used at the beginning of testing just to let the student know which function is being tested.
- default (en):
"Testing function {name}..."
- default (fi):
"Testataan {name}-funktiota..."
- available keyword arguments:
- name: Name of the function
IsNotFunction¶
Used if the function name doesn't belong to a function. Most likely the student has repurposed the function name in their main code accidentally.
- default (en):
"An object called {name} was found, but it was not a function.\nTake care to not overwrite the function with another value in your main program!"
- default (fi):
"Objekti nimeltä {name} löytyi, mutta se ei ollut funktio.\nVarmista, että olet käyttänyt oikeaa funktion nimeä, ja että funktion päälle ei pääohjelmassa kirjoiteta jotain muuta samalla nimellä."
- available keyword arguments:
- name: Name of the function
GenericErrorMsg¶
Used if no exception-specific message is found.
- default (en):
"An error occurred while calling the function.\nAdditional information:\n{ename}: {emsg}\nTest the function on your computer to get more information."
- default (fi):
"Funktiota kutsuttaessa tapahtui poikkeus.\nLisätietoja:\n{ename}: {emsg}.\nTestaa funktiota omalla koneellasi saadaksesi lisätietoja."
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
TypeError¶
Used as the default TypeError message, assuming that the type error is caused by mismatch in the number of arguments and parameters.
- default (en):
"The function expects an incorrect number of arguments. Alternatively another kind of TypeError occurred while calling the function.\nAdditional information:\n{emsg}"
- default (fi):
"Funktiolle on määritelty väärä määrä parametreja, tai sitä kutsuttaessa tapahtui jokin muu TypeError.\nTarkista tehtävänannosta millaset parametrit funktiolla tulisi olla\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
AttributeError¶
Used as the default AttributeError message, assuming that the function was not found with getattr.
- default (en):
"The function was not found, or another kind of AttributeError occurred while calling the function.\nAdditional information:\n{emsg}"
- default (fi):
"Oikean nimistä funktiota ei löytynyt, tai sitä kutsuttaessa tapahtui jokin muu AttributeError.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
EOFError¶
Used as the default EOFError message, assuming that the student function consumed more inputs than were put into stdin.
- default (en):
"An EOFError occurred while calling the function. The most likely cause is calling input too many times.\nAdditional information:\n{emsg}"
- default (fi):
"Funktio pyysi enemmän syötteitä kuin testausohjelma antoi. Tämä voi johtua väärin käsitellystä funktion lopetusehdosta.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
SystemExit¶
Used if the student function uses any forceful method to close the program mid-execution.
- default (en):
"The program was terminated through the use of:\nquit(), exit(), sys.exit(), raise SystemExit (etc.)\nYour program needs to be implemented such a way that it doesn't need any of these."
- default (fi):
"Koodin suoritus on lopetettu väärin käyttämällä jotain seuraavista:\nquit(), exit(), sys.exit(), raise SystemExit\nToteuta ohjelma siten, että näille tai vastaaville keinoille ei ole tarvetta!"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
PrintExcLine¶
Used whenever there is an exception while calling the function. Prints the line number and line content of the last line that was involved in the exception within the student's code file. Shows a question mark as the line number if PySenpai is unable to find any line within the student code from the stack trace of the exception.
- default (en):
"Caused by line {lineno}:\n{line}"
- default (fi):
"Aiheutui rivistä {lineno}:\n{line}"
- available keyword arguments:
- lineno: line number within the student module
- line: content of the line
PrintTestVector¶
Shows how the student function was called during the test. The name is historical - it used to only show the arguments, but the call is clearer and easier for the student to copy into their own code. It can be repurposed back to its old form by using the
args
keyword instead of call
.- default (en):
"Function call used:\n{call}"
- default (fi):
"Käytetty funktiokutsu:\n{call}"
- available keyword arguments:
- args: list of arguments given to the function, filtered through the args presenter
- call: function call formatted by the call presenter
PrintInputVector¶
Used to show the inputs to the student if there were any.
- default (en):
"Using inputs:\n{inputs}"
- default (fi):
"Kokeiltiin syötteillä:\n{inputs}"
- available keyword arguments:
- inputs: list of inputs, filtered through the inputs presenter
PrintStudentOutput¶
Shows the full output of the student code if
hide_output
keyword argument to test_function
is set to False (default is True). - default (en):
"Your function's output:\n{output}"
- default (fi):
"Funktiosi koko tuloste:\n{output}"
- available keyword arguments:
- output: The full output that should not have been
OutputParseError¶
Used if the output parser callback deems the student function's output unparseable and wants to abort the test case.
- default (en):
"Parsing the function's output for result values was not successful.\nCheck that your function uses the specified formatting when printing.\nReason provided by the checker:{reason}"
- default (fi):
"Funktion tulosteesta ei löytynyt kaikkia arvoja.\nVarmista että käytät tehtävänannossa määriteltyä muotoilua tulosteille.\nEpäonnistumisen syy: {reason}"
- available keyword arguments:
- reason: Reason given by the output parser
- args: List of arguments (DEPRECATED)
- inputs: List of inputs (DEPRECATED)
- output: Raw output (DEPRECATED)
OutputPatternInfo¶
Used along with output parse error. Can be overridden to give the student details about what kinds of things the output parser is looking for.
- default (en):
""
- default (fi):
""
- available keyword arguments:
CorrectResult¶
Message shown when the function passes validation.
- default (en):
"The function returned the correct value(s)"
- default (fi):
"Funktio palautti oikean tuloksen."
- available keyword arguments:
IncorrectResult¶
Default message for failed validation. Mostly used with default validators. If the validator uses custom assert messages, this is replaced by the message for the first failed assert.
- default (en):
"The function returned incorrect value(s)"
- default (fi):
"Funktio palautti väärän tuloksen."
- available keyword arguments:
PrintStudentResult¶
Used after validation regardless of outcome. Shows what the student function's result was.
- default (en):
"Your function returned: {res}"
- default (fi):
"Funktio palautti: {res}"
- available keyword arguments:
- res: Student result, filtered through the res presenter
- parsed: Result parsed from output, filtered through the parsed presenter
- output: Full raw output (DEPRECATED)
PrintReference¶
Used if the student result was incorrect. Shows the reference result, i.e. what the stundet function should have produced.
- default (en):
"Expected result: {ref}"
- default (fi):
"Olisi pitänyt palauttaa: {ref}"
- available keyword arguments:
- ref: Reference result, filtered through the ref presenter
AdditionalTests¶
Printed if there is at least one diagnosis to do.
- default (en):
"Performing additional tests that may suggest cause for the error..."
- default (fi):
"Suoritetaan lisätestejä, jotka saattavat kertoa mistä virhe johtuu..."
- available keyword arguments:
RepeatingResult¶
If
test_recurrence
is set to True (which is the default), this message is used when the student function produces the same result twice in row. - default (en):
"The function produced the same result twice in succession. This usually means the function is not reacting properly to arguments or inputs.\nThis is especially likely if this message pops up repeatedly."
- default (fi):
"Funktio tuotti kahdesti peräkkäin saman tuloksen. Tämä yleensä tarkoittaa, että funktio ei reagoi odotetulla tavalla sille annettuihin argumentteihin tai syötteisiin.\nTämä pätee erityisesti jos tämä viesti toistuu."
- available keyword arguments:
AdditionalInfo¶
This is used to precede messages from information functions if any have been given to the test.
- default (en):
"The checker gave the following as additional information:"
- default (fi):
"Tarkistin antoi myös seuraavat lisätiedot:"
- available keyword arguments:
CorrectMessage¶
If a
message_validator
is used in the test, this message is used if the validator passes. - default (en):
"The function's output was correct."
- default (fi):
"Funktion tulosteet olivat oikein."
- available keyword arguments:
IncorrectMessage¶
If a
message_validator
is used in the test and is not passed, this message is used as the default. If the validator uses custom assert messages, this is is replaced by the message for the first failed assert.- default (en):
"The function's output was incorrect."
- default (fi):
"Funktion tuloste oli virheellinen."
- available keyword arguments:
MessageInfo¶
Used if the message validation did not pass. Gives additional information about what the messages shouold contain.
- default (en):
""
- default (fi):
""
- available keyword arguments:
Program Test Messages¶
These messages are used by
test_program
ProgramName¶
Used at the beginning of testing.
- default (en):
"Testing program..."
- default (fi):
"Testataan ohjelmaa..."
- available keyword arguments:
- name: Name of the studet module
GenericErrorMsg¶
Used if no exception-specific message is found.
- default (en):
"An error occurred while running the program.\nAdditional information:\n{ename}: {emsg}\nTest the program on your computer to get more information."
- default (fi):
"Ohjelmaa suorittaessa tapahtui poikkeus.\nLisätietoja:\n{ename}: {emsg}\nTestaa ohjelmaa omalla koneellasi saadaksesi lisätietoja."
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
EOFError¶
Used if there's an EOF error while trying to run the student module. The error message is written from the perspective that the most likely cause is the use of input in a way that goes against the exercise description.
- default (en):
"The program prompted for more inputs than were provided by the tester. This is likely caused by faulty end condition handling.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelma pyysi enemmän syötteitä kuin testausohjelma antoi. Tämä voi johtua väärin käsitellystä ohjelman lopetusehdosta. Lisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
ValueError¶
Default message for ValueError. The assumption behind this message is that inputs were not handled properly.
- default (en):
"The program prompted for more inputs than were provided by the tester. This is likely caused by faulty end condition handling.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelmaa suorittaessa tapahtui ValueError. Tämä voi johtua siitä, että virheellisiä syötteitä ei ole käsitelty oikein.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
TypeError¶
Default message for TypeError. The assumption is that inputs were not converted properly.
- default (en):
"A TypeError occurred while running the program. This can be the result of not converting user inputs into proper types (inputs are always strings).\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelmaa suorittaessa tapahtui TypeError. Tämä voi johtua siitä, että syötteitä ei muuteta ennen käyttöä (syötteet ovat aina merkkijonoja).\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
IndexError¶
Default message for IndexError. The assumption is that there are split inputs and their length is not checked properly.
- default (en):
"An IndexError occurred while running the program. This can be caused by improper handling of split inputs, i.e. failing to check that the input contained enough parameters using the correct separator.\nAdditional information:\n{emsg}"
- default (fi):
"Ohjelmaa suorittaessa tapahtui IndexError. Tämä voi johtua siitä, että ohjelma ei käsittele oikein moniosaisia syötteitä, joista puuttuu osia, tai joissa on väärä erotin.\nLisätietoja:\n{emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
SystemExit¶
Used if the student code has a forced exit (i.e. exit, sys.exit or similar).
- default (en):
"The program was terminated through the use of:\nquit(), exit(), sys.exit(), raise SystemExit (etc.)\nYour program needs to be implemented such a way that it doesn't need any of these."
- default (fi):
"Koodin suoritus on lopetettu väärin käyttämällä jotain seuraavista:\nquit(), exit(), sys.exit(), raise SystemExit\nToteuta ohjelma siten, että näille tai vastaaville keinoille ei ole tarvetta!"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- inputs: List of inputs (DEPRECATED)
PrintExcLine¶
Used whenever there is an exception while running the program. Prints the line number and line content of the last line that was involved in the exception within the student's code file. Shows a question mark as the line number if PySenpai is unable to find any line within the student code from the stack trace of the exception.
- default (en):
"Caused by line {lineno}:\n{line}"
- default (fi):
"Aiheutui rivistä {lineno}:\n{line}"
- available keyword arguments:
- lineno: line number within the student module
- line: content of the line
PrintInputVector¶
Used to show the inputs to the student.
- default (en):
"Using inputs:\n{inputs}"
- default (fi):
"Käytettiin syötteitä:\n{inputs}"
- available keyword arguments:
- inputs: list of inputs, filtered through the inputs presenter
OutputParseError¶
Used if the output parser callback deems the student program's output unparseable and wants to abort the test case.
- default (en):
"Parsing the program's output for result values was not successful.\nCheck that your program uses the specified formatting when printing.\nReason provided by the checker:{reason}"
- default (fi):
"Ohjelman tulosteesta ei löytynyt kaikkia arvoja.\nVarmista että käytät tehtävänannossa määriteltyä muotoilua tulosteille.\nEpäonnistumisen syy: {reason}"
- available keyword arguments:
- reason: Reason given by the output parser
- inputs: List of inputs (DEPRECATED)
- output: Raw output (DEPRECATED)
OutputPatternInfo¶
Used along with output parse error. Can be overridden to give the student details about what kinds of things the output parser is looking for.
- default (en):
""
- default (fi):
""
- available keyword arguments:
PrintStudentOutput¶
Shows the full output of the student code if
hide_output
keyword argument to test_program
is set to False (default is True). - default (en):
"Your program's output:\n{output}"
- default (fi):
"Ohjelmasi koko tuloste:\n{output}"
- available keyword arguments:
- output: The full output that should not have been
CorrectResult¶
Message shown when the program passes validation.
- default (en):
"The program performed correctly.
- default (fi):
"Ohjelma toimi oikein."
- available keyword arguments:
IncorrectResult¶
Default message for failed validation. Mostly used with default validators. If the validator uses custom assert messages, this is replaced by the message for the first failed assert.
- default (en):
"The program's output contained incorrect results."
- default (fi):
"Ohjelman tuloste sisälsi virheellisiä arvoja."
- available keyword arguments:
PrintStudentResult¶
Used after validation regardless of outcome. Shows what the student function's parsed result was.
- default (en):
"The following values were parsed from your program's output:\n{parsed}"
- default (fi):
"Ohjelman tulosteesta löytyneet arvot:\n{parsed}"
- available keyword arguments:
- parsed: Result parsed from output, filtered through the parsed presenter
- output: Full raw output (DEPRECATED)
PrintReference¶
Used if the student result was incorrect. Shows the reference result, i.e. what the stundet function should have produced.
- default (en):
"Expected to find these values:\n{ref}"
- default (fi):
"Arvot joiden olisi pitänyt löytyä:\n{ref}"
- available keyword arguments:
- ref: Reference result, filtered through the ref presenter
AdditionalTests¶
Printed if there is at least one diagnosis to do.
- default (en):
"Performing additional tests that may suggest cause for the error..."
- default (fi):
"Suoritetaan lisätestejä, jotka saattavat kertoa mistä virhe johtuu..."
- available keyword arguments:
RepeatingResult¶
If
test_recurrence
is set to True (which is the default), this message is used when the student program produces the same parsed result twice in row. - default (en):
"The program produced the same result twice in succession. This usually means the program is not reacting properly to inputs.\nThis is especially likely if this message pops up repeatedly."
- default (fi):
"Ohjelma tuotti kahdesti peräkkäin saman tuloksen. Tämä yleensä tarkoittaa, että ohjelma ei reagoi odotetulla tavalla sille annettuihin syötteisiin.\nTämä pätee erityisesti jos tämä viesti toistuu."
- available keyword arguments:
AdditionalInfo¶
This is used to precede messages from information functions if any have been given to the test.
- default (en):
"The checker gave the following as additional information:"
- default (fi):
"Tarkistin antoi myös seuraavat lisätiedot:"
- available keyword arguments:
CorrectMessage¶
If a
message_validator
is used in the test, this message is used if the validator passes. - default (en):
"The program's output was correct."
- default (fi):
"Ohjelman tulosteet olivat oikein."
- available keyword arguments:
IncorrectMessage¶
If a
message_validator
is used in the test and is not passed, this message is used as the default. If the validator uses custom assert messages, this is is replaced by the message for the first failed assert.- default (en):
"The program's output was incorrect."
- default (fi):
"Ohjelman tuloste oli virheellinen."
- available keyword arguments:
MessageInfo¶
Used if the message validation did not pass. Gives additional information about what the messages shouold contain.
- default (en):
""
- default (fi):
""
- available keyword arguments:
Static Test Messages¶
These messages are used by
static_test
. StaticTest¶
Used at the beginning of the test.
- default (en):
"Checking the source code for violations of restrictions set by the assignment..."
- default (fi):
"Tarkistetaan noudattaako koodi tehtävänannon rajoituksia..."
- available keyword arguments:
- fname: Name of the function that is examined
GenericErrorMsg¶
Used if no exception-specfic message is found.
- default (en):
"Something went wrong while reading the source code.\nAddional information:\n{ename}: {emsg}"
- default (fi):
"Jokin meni pieleen lähdekoodia luettaessa.\nLisätietoja:\n{ename}: {emsg}"
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- fname: Name of the examined function
AttributeError¶
Used if the function is not found.
- default (en):
"A function called {fname} was not found from your code file."
- default (fi):
"{fname}-nimistä funktiota ei löytynyt kooditiedostosta."
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- fname: Name of the examined function
OSError¶
Used if the source code file is unreadable.
- default (en):
"Failed to read the source code."
- default (fi):
"Lähdekoodin lukeminen epäonnistui."
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
- fname: Name of the examined function
CorrectResult¶
Used if there are no problems in the code.
- default (en):
"No problems were found in the source code."
- default (fi):
"Koodista ei löytynyt ongelmia."
- available keyword arguments:
Pylint Test Messages¶
These messages are used by
pylint_test
LintTest¶
Used at the beginning of the test.
- default (en):
"Testing code quality..."
- default (fi):
"Tarkistetaan koodin laatua..."
- available keyword arguments:
GenericErrorMsg¶
Used if no exception-specfic message is found.
- default (en):
"Running the test failed.\nAdditional information:\n{ename}: {emsg}."
- default (fi):
"Testaus epäonnistui.\nLisätietoja:\n{ename}: {emsg}."
- available keyword arguments:
- ename: Name of the exception
- emsg: Exception message from the stack trace
LintSuccess¶
Used if the lint result passes the validator (even if there are notifications from the linter)
- default (en):
"Your code passed the quality check with score {global_note:.1f} / 10.0."
- default (fi):
"Koodisi läpäisi laatutarkistuksen pisteillä {global_note:.1f} / 10.0."
- available keyword arguments:
- all attributes of lint result's linter.stats object (the lint score is in
global_note
)
LintFailMessage¶
Used if the lint result does not pass the validator.
- default (en):
"Your code didn't pass the quality test."
- default (fi):
"Koodisi ei läpäissyt laatutarkistusta."
- available keyword arguments:
- all attributes of lint result's linter.stats object (the lint score is in
global_note
)
pylint_fail_low_score¶
This message is used by the default pylint score based validator instead of LintFailMessage.
- default (en):
"Your code received too low quality score ({global_note:.1f} / 10.0).\nTarget: 5+ / 10.0."
- default (fi):
"Koodisi sai liian pienet laatupisteet ({global_note:.1f} / 10.0).\nTavoite: 5+ / 10.0."
- available keyword arguments:
- all attributes of lint result's linter.stats object (the lint score is in
global_note
)
LintMessagesBegin¶
Used before printing the individual lint messages.
- default (en):
"Problems found in the code are listed below."
- default (fi):
"Koodista löytyneet ongelmat on listattu alla."
- available keyword arguments:
LintConvention¶
Used for linter notifications classified as a convention violation.
- default (en):
"Convention violation at {module}, line {line}. Explanation:\n{message}"
- default (fi):
"Käytäntöjä rikkovaa koodia tiedostossa {module}, rivillä {line}. Selitys:\n{message} ({symbol})"
- available keyword arguments:
- all attributes of the msg object
- module: Name of the code file
- line: Location of the violation
- message: Human-readable note (always in English)
- symbol: Violation symbol (for googling etc.)
LintRefactor¶
Used for linter notifications classified as "refactor needed".
- default (en):
"Bad code at {module}, line {line}. Explanation:\n{message}"
- default (fi):
"Huonolaatuista koodia tiedostossa {module}, rivillä {line}. Selitys:\n{message} ({symbol})"
- available keyword arguments:
- all attributes of the msg object
- module: Name of the code file
- line: Location of the violation
- message: Human-readable note (always in English)
- symbol: Violation symbol (for googling etc.)
LintWarning¶
Used for linter notifications classified as a warning.
- default (en):
"Potential problem at {module}, line {line}. Explanation:\n{message}"
- default (fi):
"Mahdollinen ongelmien aiheuttaja tiedostossa {module}, rivillä {line}. Selitys:\n{message} ({symbol})"
- available keyword arguments:
- all attributes of the msg object
- module: Name of the code file
- line: Location of the violation
- message: Human-readable note (always in English)
- symbol: Violation symbol (for googling etc.)
LintError¶
Used for linter notifications classified as an error.
- default (en):
"Probable problem at {module}, line {line}. Explanation:\n{message}"
- default (fi):
"Todennäköinen ongelmien aiheuttajat tiedostossa {module}, rivillä {line}. Selitys:\n{message} ({symbol})"
- available keyword arguments:
- all attributes of the msg object
- module: Name of the code file
- line: Location of the violation
- message: Human-readable note (always in English)
- symbol: Violation symbol (for googling etc.)
LintFatal¶
Used for linter notifications classified as fatal.
- default (en):
"Unable to continue after {module}, line {line}. Explanation:\n{message}"
- default (fi):
"Tarkistuksen keskeyttänyt ongelma tiedostossa {module}, rivillä {line}. Selitys:\n{message} ({symbol})"
- available keyword arguments:
- all attributes of the msg object
- module: Name of the code file
- line: Location of the violation
- message: Human-readable note (always in English)
- symbol: Violation symbol (for googling etc.)
Anna palautetta
Kommentteja materiaalista?