Code style issue: variable names should really be better than aaa, bbb, and ccc. Please assign some meaningful names to the variables. first and second are also not very fortunate names, maybe something like from/to or source/target would be better?
UX/test style issue: failed tests should use failure messages to present inputs which cased failure. You can see example kata or Python authoring guide for examples.
The "Parser" name does not really make sense. I imagine "parsing" as transformation form a textual form, and this is not what really happens here.
Returning -1 for negative inputs does not seem to be the most fortunate design. If negative values are invalid input, then this should be signalled in a way appropriate for each language (throwing an exception of an appropriate type, raising an error, returning Error type). But why would the negative values be wrong at all? I imagine they would make sense if interpreted as "time in the past", or something.
Hi,
'S'
should return None while it's supposed to be taken as's'
.None
when the value is negative? A negative timedelta makes sense.Cheers
What is
DateParser
, and why is it preloaded? Users do not have to implement it, so why is it tested?aaa
,bbb
, andccc
. Please assign some meaningful names to the variables.first
andsecond
are also not very fortunate names, maybe something likefrom
/to
orsource
/target
would be better?No Random Tests
Error
type). But why would the negative values be wrong at all? I imagine they would make sense if interpreted as "time in the past", or something.