Skip to content

secret-handshake: update tests to canonical version v1.1.0#1085

Merged
cmccandless merged 7 commits intoexercism:masterfrom
cmccandless:fix-1006
Jan 9, 2018
Merged

secret-handshake: update tests to canonical version v1.1.0#1085
cmccandless merged 7 commits intoexercism:masterfrom
cmccandless:fix-1006

Conversation

@cmccandless
Copy link
Contributor

  • updated tests
  • removed redundant/conflicting tests
  • updated example solution

Resolves #1006

Copy link
Contributor

@ilya-khadykin ilya-khadykin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

import unittest

from secret_handshake import handshake, code
from example import handshake, code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to revert this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

idx = newidx
s.reverse()
return s
def handshake(code):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your names for parameters, what do you think of updating https://github.com/exercism/python/blob/master/exercises/secret-handshake/secret_handshake.py for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return actions if code < 16 else list(reversed(actions))


def code(actions):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secret_code looks a bit better in this case I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

self.assertEqual(code(['wink', 'sneeze']), '0')
# Track-specific tests

def test_code1(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should skip tack-specific tests and let the user decide if he/she wants to write the code which passes them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea, since in this case the track-specific tests involve a method that isn't tested for in the canonical tests.

@stale
Copy link

stale bot commented Jan 9, 2018

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the abandoned label Jan 9, 2018
@cmccandless cmccandless merged commit bc66616 into exercism:master Jan 9, 2018
@cmccandless cmccandless deleted the fix-1006 branch January 9, 2018 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants