Converting Python testscript to TESTed - errors with OOP excercise #5257
-
Dear, In my attempt to move the testscript to TESTed, I run into error I can't seem to fix. I have the following exercise: https://dodona.be/nl/activities/912288875/ with a testscript using "pythia_judge": "doctest" with all the tests I want to execute which work well. I have made a copy of this exercise: https://dodona.be/nl/activities/844895513/ with an attempt to test is with TESTed, but run into a couple of issues:
Further, I was able to get the assertion error tested. Thanks in advance for your help. Rgds, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @marcothijs I noticed this question when going through open notifications. We probably missed this one during the Christmas break. Sorry! |
Beta Was this translation helpful? Give feedback.
-
Also my apologies for missing this! For the first two points, the issue is that we currently don't support running arbitrary functions, and don't have a programming-language independent way of doing print/repr (and there are no concrete plans for supporting it soon). However, we do have language-specific literals for this use case (see the docs here). They do have some drawbacks, but they are a good fit in this case. For example, transform this: - statement: 'punt1 = Punt(1.0, 1.0)'
- expression: 'punt1.__repr__()'
return: "(1.0, 1.0)" To this: - statement: 'punt1 = Punt(1.0, 1.0)'
- expression:
python: 'repr(punt1)'
return: "(1.0, 1.0)" This way, the expression is not limited to the language-independent DSL of TESTed, but you use arbitrary Python code. The assignment of properties is also not supported, but that is more of an oversight, we do want to do this at some point (see dodona-edu/universal-judge#500). - statement:
python: 'p_h1.y = 3.0'
- expression: 'p_h1.y'
return: 3.0 |
Beta Was this translation helpful? Give feedback.
Also my apologies for missing this!
For the first two points, the issue is that we currently don't support running arbitrary functions, and don't have a programming-language independent way of doing print/repr (and there are no concrete plans for supporting it soon).
However, we do have language-specific literals for this use case (see the docs here). They do have some drawbacks, but they are a good fit in this case.
For example, transform this:
To this:
This way, the expression is not limited to…