-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
I was mentoring a friend who solved the problem in a way that surprised me: his __repr__
implementation always returned the values the clock was initially constructed with. Regardless of how you mutated the clock, his __repr__
would stay the same. Since this incorrect solution passed all existing tests, I'd like to add a couple more tests.
Since the tests for __repr__
are in practice/clock/.meta/additional_tests.json
, I'm assuming this repo is the right place to add some additional tests.
From looking at how the tests are generated, I'm not sure what the easiest approach would be. The way the current repr
type tests are setup makes it easy to add "create a Clock, immediately call __repr__
" tests, but adding a couple of tests that add/subtract before calling __repr__
would probably require a new type of test? (since it would need different treatment by the Jinja template).
I was also thinking about adding tests of __repr__
in addition to __str__
to the add
and subtract
tests (since those tests are why __str__
has to update), but that would require the Jinja template to reformat each hh:mm
string from upstream into Clock(hh,mm)
while removing the leading zeros. I'm not really familiar with Jinja, so that seems like it might be complicated to template correctly.
I'm happy to make a PR, but I'd like input first on how they should be added. :)