Files
python/exercises/practice/secret-handshake/secret_handshake_test.py
BethanyG be794198e1 [Resistor Color Expert]: Corrected Small Typos (#3469)
* Corrected small typos around resistor bands.

* Due to failing CI, alterations to the test generator script were needed.
The generated vs submitted diff now skips the first three lines of the file
so that the generation date is not picked up and flagged as needing regeneration.

Sadly, a workaround was also needed to prevent Python difflib from noting the difference
anyways and producing an empty "false positive" diff.

All templates and test files also needed to be altered to ensure that the first three
lines of every test file will always be the autogeneration comment and date.

Hopefully, this will now stop the CI failures without creating any subtle additional bugs.

* Touch up to bowling template.  Added back the error raising utility.
* Touch up to two-bucket template to add back in error raising utility.
[no important files changed]
2023-07-21 16:54:40 -07:00

49 lines
1.5 KiB
Python

# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/secret-handshake/canonical-data.json
# File last updated on 2023-07-19
import unittest
from secret_handshake import (
commands,
)
class SecretHandshakeTest(unittest.TestCase):
def test_wink_for_1(self):
self.assertEqual(commands("00001"), ["wink"])
def test_double_blink_for_10(self):
self.assertEqual(commands("00010"), ["double blink"])
def test_close_your_eyes_for_100(self):
self.assertEqual(commands("00100"), ["close your eyes"])
def test_jump_for_1000(self):
self.assertEqual(commands("01000"), ["jump"])
def test_combine_two_actions(self):
self.assertEqual(commands("00011"), ["wink", "double blink"])
def test_reverse_two_actions(self):
self.assertEqual(commands("10011"), ["double blink", "wink"])
def test_reversing_one_action_gives_the_same_action(self):
self.assertEqual(commands("11000"), ["jump"])
def test_reversing_no_actions_still_gives_no_actions(self):
self.assertEqual(commands("10000"), [])
def test_all_possible_actions(self):
self.assertEqual(
commands("01111"), ["wink", "double blink", "close your eyes", "jump"]
)
def test_reverse_all_possible_actions(self):
self.assertEqual(
commands("11111"), ["jump", "close your eyes", "double blink", "wink"]
)
def test_do_nothing_for_zero(self):
self.assertEqual(commands("00000"), [])