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.
PS: that means this case is out of the scope of the kata, btw, if
obj
is the instance and not the class itself. But your code shouldn't raise in any case.all methods are assigned directly to the class, and not to instances, now. So your code shouldn't actually raise an error for this specific case, afaik.
I've been trying for a week or so to resolve this, I'm getting close but I cannot pass all the random tests - I always fail 10 - 20 tests depending on the number: Passed: 668 Failed: 17 Exit Code: 1
All of them fail for the same reason: <function Meta.make_interceptor.._wrapped at 0x7fe3069021f0> should equal 'grtisp'
I know Monadius pointed out that: Examples in the description show that new methods are assigned to instances, but the tests never do this: Methods are assigned to classes -> can you confirm this ?
For example, my code will raise an AttributeError for this:
obj.foo = lambda self,a,b,c,d,e: '5 params function'
print(obj.foo(1,2,3,4,5))
Maybe it's not that and my code simply cannot handle some corner case, but can you give me a hint at least ? Because it's getting really frustrating...
That test checks whether object methods can access the implicitely passed variable (normally called
self
). Note this should work, whether the variable is calledself
or something else. Looking at your code, I think you are having trouble with that second part.As an example, this code should work:
My code fails at the following test: Methods can access 'self' var, even when not named 'self'.
Traceback (most recent call last):
File "/workspace/default/src/codewars-test/codewars_test/test_framework.py", line 111, in wrapper
func()
File "tests.py", line 212, in access_test
test.assert_equals(the_ob.self_access('World'), 'World2')
I'm not sure what else to verify...can you be more specific about the test case?