4 kyu
Restore IPv4Address class
80saigono
Loading description...
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.
Great kata, I've learned a lot. That's the kind of kata that feel full.
Great kata. One tiny stumbling block for me was that the init assigns to self._parts, but then the tests look at self.parts. I assumed they'd be checking for immutability on the underscored version. (Or maybe they're hinting that we should keep both separately...)
Yeah, honestly I was considering that as an issue before beta approval but thought it would not be pretty crucial...
For now changed in the initial solution
self._parts
toself.parts
as more suitable with the actual tests, thanks for your feedback :)I'm more bothered with comparison tests that rely on the existence of the
parts
attribute, actually. This is not bad per se, but this is totally white box testing.I was also annoyed with the
_parts
vsparts
thing, but this is mostly because of the non existence of specifications. A "private" (underscore thing) against a frozen public propety (without the underscore) is quite usual in python.@Blind4Basics as well as the actual tests which would surely throw an exception for non-existing
self.parts
, actually (got it myself during completing the kata). At least, according to the lore and such, that could've been considered as a slight-ish hint... that, or you can go over it in other ways tbhSo yeah, honestly I don't think the comparison tests having the
MockObject
withparts
is a big problem, especially with the fixed initial solution (unless I'm missing something at 9 AM...)Currently, aside the not-so-critical suggestion below, there are no critical issues with this kata, so let's check the current assessed ranks:
Considering this kata seems to be pretty solid in terms of assertions about class
IPv4Address
, as well as the approach for its solution + the estimated rank by author itself is 4 kyu, I'll set that difficulty as well. Thank you for the kata!There should be enforced methods
__int__
,__bytes__
.There should not be method
from_string
, rather the class should accept various types in__new__
, like here https://docs.python.org/3/library/ipaddress.htmlipaddress
also has__format__
, and also allows adding/subtracting integers from them, and also has a ton of other functionalities, so...Not sure that copying every single bit from standard library will be helpful
The current set of methods does not teach solvers a best practice.
It is also not understandable, why you ask to implement hash method, if you don't use it as designed (i.e. testing sets of IpAddress, using IpAddress as key of dict, etc.)
There should be random tests.
It is mandated by every kata: see https://docs.codewars.com/authoring/guidelines/submission-tests#random-tests
it is not mandated for every kata, see "Under some rare circumstances, it is allowed to use so-called randomized tests instead of fully random ones."
Terminology is quite weak in this section of documentation. I doubt that it is expected to have truly random tests instead of tests with randomised testing values.
I will update the tests, making the basic ones (visible to user) with only fixed inputs. And extended version with randomised inputs, duplicating existing ones. Even though the solution passing all the already provided tests will be laborious enough to be seen as actually showing the skillset reauired to solve this kata normally.
Please explain what makes you kata so special you can just ignore the standard practice for every kata. Note that this has been done only for several katas out of thousands of katas, and it's usually due to severe technical limitations, not "I believe my kata is so simple/elegant random test cases aren't necessary". You're not gonna convince everyone around (include me) with that here.
Not even trying to convince. Just pointing out that the rule that not enforced autotaically and has exceptions can not be mandatory.
the true question here is: is that very difficult to generate random tests for your kata (edit: or a limited set of possible inputs)? As long as the answer is no, the random tests are mandatory.
Yeah, it all makes sense. @Voile apologies for being overly defensive. Shouldn't have been answering to the comments in the middle of the night.
Tests have been updated