Again, thanks for the feedback! This issue was quite hard to resolve. So I have tried to address all 'cheating' ways to solve this kata. Now 'cheating' is not completely impossible, but these ways are at least as difficult as solving this puzzle in intended way.
It is done intentionally: to show that output of weird_mul(A, B) and weird_mul(B, A) is the same in first case (the calls of function are formally different)
fixed
In the description I have marked that if the shape of the input matrix is not 2d, function should return None, so I guess in this example (with not valid B) you have an output, which is a 2d matrix and the test to compare it to None fails. But in my opininon, it is a problem of the limitations of test framework, not working with 2d matrices. No idea how to fix this.
This is the code I use here:
test.assert_equals(weird_mul(A, C), None, 'Should return None in case of 1d input')
Again, if the output is 2d numpy array assertion throws an error
I fixed both issues: there are no more double calls in random tests as well as there are no more mistakes there (caused by generating 0-shape matrices).
Also I have changed the description and the solution: now if warrior tries to pass wrong- or 0-shaped matrices, function should return None.
Again, thanks for the feedback! This issue was quite hard to resolve. So I have tried to address all 'cheating' ways to solve this kata. Now 'cheating' is not completely impossible, but these ways are at least as difficult as solving this puzzle in intended way.
Thanks for your feedback! Issue fixed.
Instead I have restricted the usage of dis module
Unfortunately, I can't do this:
I got Error when submitting any solution, because it requires importing((
Traceback (most recent call last):
File "main.py", line 2, in
NameError: name 'import' is not defined
Thanks for your feedback :)
Hi!
This is the code I use here:
test.assert_equals(weird_mul(A, C), None, 'Should return None in case of 1d input')
Again, if the output is 2d numpy array assertion throws an error
I fixed both issues: there are no more double calls in random tests as well as there are no more mistakes there (caused by generating 0-shape matrices).
Also I have changed the description and the solution: now if warrior tries to pass wrong- or 0-shaped matrices, function should return None.
Thanks for the feedback, I will checke everything again tomorrow :)
It works with 1d arrays, but not with 2d arrays.
I have used decorators, fixed the input from A = [2] to A = [[2]], but...
I can't use
test.assert_equals(weird_mul(A, B), AB)
I've got an error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I have done more examples and tried to described 'edge_classes' example in the description
Thanks for your feed back again. I have fixed all the issues.
I have tried new python test framework, but the decorators (@describe) are not working. I receive an error message "name 'describe is not found"
Thanks for your comment! This is my first Kata, so I will try to change everything accordingly.