Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
python new test frameworks
python new test framework is required.
Python: Random tests are vulnerable to input modification
Python: see this
The description says:
But
a.uis an instance of the classUwhich does not have a copy constructor.This also implies that we should copy the attributes when
getattris called, but theit_5tests don't follow this, in particular with this test:If I actually copy the attributes, I fail this test.
(I would also like to bring attention to this unresolved issue from 4 years ago, which also caused me some frustration.)
Copy/paste the example tests to a section of the Submit tests.
This absolutely prevents solutions failing the Example tests but passing the Submit tests, which is very hard to explain if it happens.
( I don't know how a solution would achieve that, but solvers can be very creative. )
If
arbitrarygeneratesn = 0, which it can,odds !! ((-1) `div` 2)will throw that error.Use
quotinstead ofdiv, or just lose the-1.I read "tests will only use odd numbers less then
2000" as results of multiplications not being larger than1999, not individual multiplicands. Apparently, I read that very wrong.Or you could explain it better. :]
You should do something to prevent this
new update to Python 3.11 is required.
Empty repl inputs are silently dropped from the expected result (this only occurs in the "full session" test).
This kata is unsolvable in general: there is a test case
But this could easily be
And there is no way to parse such cases correct unless we run a repl in Python 2(!) ourselves, read every line of input,
evalthe blocks ourselves and capture the output.What is the input size? This should be provided.
Hi,
For your convenience, two objects: NO_SUCH and NONE are predefined, which has copy constructor.:has->haveI fear this part is a lost cause... (because
'DEL'and''(for undefined attributes) are both colliding with a proper mro anyway).The
DELrequirement doesn't make any sense. Considering a case like this (which is in the tests):At this point, to get a proper/consistent mro,
a.xshould return something equal to 42 and nothing else.The
get_change=='DEL'requirement can only make sense if it follows a behavior like this:- After deletion of
a.x:a.xreturns the class level value with a get_change property being'DEL'X.xreturns its value with a get_change property being'INIT'- Changing the class level property after deletion of
a.xwould lead to:a.xreturns the new class level value with a get_change property being'DEL'X.xreturns its new value with a get_change property being'MOD'(yeah, out of the scope of the current kata, but if the specs are to be mde consistent, that would need to be implemented as well)a.xwould need to return a special token as value (not even NONE or NO_SUCH, which could be seen as an actual value assigned. For NONE, at least), withget_change=='DEL'. But that's rather dirty... (see next point)The
get_change==''for undefined attributes is colliding as well with a proper mro. If the attribute is not defined, an AttributeErrror should be raised, period. This would actually resolve the DEL case (as being plain invalid implementation)Cheers
This comment is hidden because it contains spoiler information about the solution
Loading more items...