7 kyu
Thinkful - Object Drills: Quarks
2,471 of 3,863Grae-Drake
Loading description...
Fundamentals
Object-oriented Programming
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
for what in examples
q1.color
should output color of q1, in my solution it doesn`t work but tests all passedHalf of what the description requests is never tested. Yet almost all of the submitted solutions appear to have known not to worry about handling valid colours, flavours or assigning the bayron_number to the class and not to each object. How???
My solution passed because I was looking to find the wording for the error message when the value for color or flavor was wrong.
This comment has been hidden.
Don't forget the spoiler tag.
Sorry, I'm new here. If it's possible to edit, I can omit the spoiler.
Rust translation
Approved by someone
Factor translation: adapt description for
interact
; it's not a method, nor is it named.interact
Can someone explain this line? self.color, other.color = other.color, self.color
this swaps the assignments
.
nice one,educational...thks
Factor translation (author inactive)
Approved
Published a java translation, looking for feedback :)
Suggestion: Remove
valid color
andvalid flavor
from the description.Looking at
zebulans
issue that was resolved 5 years ago, a decision was made to not test forcolor
norflavor
. We should rephrase the corresponding paragraph to avoid further confusion :)Yeah, I spent considerable time searching for how to restrict the values to the valid colors and flavors. Btw can anyone tell me how?
Nice educational kata.
Python new test framework should be used with 3.8 enabled
Done.
Ruby translation, please review and approve!
C# translation Kumited, please review and approve.
'alr approved some time ago'
Any chance for C++ version?
@Grae-Drake
,I noticed a few minor issues with your kata:
You aren't testing invalid inputs even though your description seems to imply you will. This could be fixed by telling the user to raise an error and making sure they do with a few
test.expect_error(message, thunk)
tests. Codewars Docsinteract
You are missing a period in one of the examples in your description:
>>> q2 color
should be>>> q2.color
You aren't properly handling Python 2's floor division. In Python 2,
1 / 3 == 0
(floor division by default). You could either make at least one of the numbers a float,1 / 3.0
or you could useoperator.truediv(1, 3)
which works for both Python 2 & 3.You aren't actually using
my_Quark
in your tests. If you had, you might have noticed that thebaryon_number
in it is1 / 4
(which is also0
in Python 2).Thanks!
Thanks for the detailed feedback @zebulan. I intended to require error handling but after beating my head against
test.expect_error
and getting the opposite of what I wanted I gave up and (imperfectly, it looks like) removed that requirement. If you're familiar with the error testing here I'd appreciate help understanding how to properly implement that.You can make a function that will try to create a Quark with a bad color. That function should throw/raise an error so in javascript:
I suppose Python is pretty similar.
@Grae-Drake: Other options are:
unittest
module which contains theassertRaises
method (see this).test.assert_equals
(see example below).Regards,
suic
Although I agree with
@zebulan
's comments, seeing that the kata was completed 100+ times in its current form and that the author gave up on testing wrong inputs, I suggest to resolve the issue, and approve the kata.This would yield a simple (~7 kyu) kata ready for the public, while leaving the option to create an advanced version of it later, with proper error checking and all the bells and whistles, for 5-6 kyu.
By the way, I fixed the description and the minor issues (int -> float, 1/4 -> 1/3).
JS translation kumited. ; ) )