示例#1
0
    def test_zero(self):
        round_number = 0
        want = [0, 1, 2]
        got = get_rounds(round_number)

        self.assertEqual(
            want,
            got,
            msg=f'Expected {want} but got an incorrect result: {got!r}')
示例#2
0
    def test_random_int(self):
        round_number = random.randint(0, 100)
        want = [round_number + i for i in range(3)]
        got = get_rounds(round_number)

        self.assertEqual(
            want,
            got,
            msg=f'Expected {want} but got an incorrect result: {got!r}')
示例#3
0
    def test_instructions_example(self):
        round_number = 27
        want = [27, 28, 29]
        got = get_rounds(round_number)

        self.assertEqual(
            want,
            got,
            msg=f'Expected {want} but got an incorrect result: {got!r}')
示例#4
0
    def test_get_rounds(self):

        input_vars = [0, 1, 10, 27, 99, 666]

        results = [[0, 1, 2], [1, 2, 3], [10, 11, 12], [27, 28, 29],
                   [99, 100, 101], [666, 667, 668]]

        for variant, (number, rounds) in enumerate(zip(input_vars, results),
                                                   start=1):
            error_message = f'Expected rounds {rounds} given the current round {number}.'
            with self.subTest(f'variation #{variant}',
                              input=number,
                              output=rounds):
                self.assertEqual(rounds, get_rounds(number), msg=error_message)