def test_other_no_change(self):
        hand = [1, 2, 3]
        want = [1, 2, 3]
        maybe_double_last(hand)

        self.assertEqual(
            hand,
            want,
            msg=f'Expected {want} but got an incorrect result: {hand!r}'
        )
    def test_instructions_example_2(self):
        hand = [5, 9, 10]
        want = [5, 9, 10]
        maybe_double_last(hand)

        self.assertEqual(
            hand,
            want,
            msg=f'Expected {want} but got an incorrect result: {hand!r}'
        )
Beispiel #3
0
    def test_other_doubles(self):
        hand = [1, 2, 11]
        want = [1, 2, 22]
        got = maybe_double_last(hand)

        self.assertEqual(
            want,
            got,
            msg=f'Expected {want} but got an incorrect result: {got!r}')
Beispiel #4
0
    def test_instructions_example_1(self):
        hand = [5, 9, 11]
        want = [5, 9, 22]
        got = maybe_double_last(hand)

        self.assertEqual(
            want,
            got,
            msg=f'Expected {want} but got an incorrect result: {got!r}')
Beispiel #5
0
    def test_maybe_double_last(self):

        input_vars = [[1, 2, 11], [5, 9, 11], [5, 9, 10], [1, 2, 3]]

        results = [[1, 2, 22], [5, 9, 22], [5, 9, 10], [1, 2, 3]]

        for variant, (hand,
                      doubled_hand) in enumerate(zip(input_vars, results),
                                                 start=1):
            error_message = f'Expected {doubled_hand} as the maybe-doubled version of {hand}.'
            with self.subTest(f'variation #{variant}',
                              input=hand,
                              output=doubled_hand):
                self.assertEqual(doubled_hand,
                                 maybe_double_last(hand),
                                 msg=error_message)