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.u
is an instance of the classU
which does not have a copy constructor.This also implies that we should copy the attributes when
getattr
is called, but theit_5
tests 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
arbitrary
generatesn = 0
, which it can,odds !! ((-1) `div` 2)
will throw that error.Use
quot
instead 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,
eval
the 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
->have
I fear this part is a lost cause... (because
'DEL'
and''
(for undefined attributes) are both colliding with a proper mro anyway).The
DEL
requirement 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.x
should 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.x
returns the class level value with a get_change property being'DEL'
X.x
returns its value with a get_change property being'INIT'
- Changing the class level property after deletion of
a.x
would lead to:a.x
returns the new class level value with a get_change property being'DEL'
X.x
returns 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.x
would 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...