* 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]
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
# These tests are auto-generated with test data from:
|
|
# https://github.com/exercism/problem-specifications/tree/main/exercises/killer-sudoku-helper/canonical-data.json
|
|
# File last updated on 2023-07-19
|
|
|
|
import unittest
|
|
|
|
from killer_sudoku_helper import (
|
|
combinations,
|
|
)
|
|
|
|
|
|
class KillerSudokuHelperTest(unittest.TestCase):
|
|
def test_1(self):
|
|
self.assertEqual(combinations(1, 1, []), [[1]])
|
|
|
|
def test_2(self):
|
|
self.assertEqual(combinations(2, 1, []), [[2]])
|
|
|
|
def test_3(self):
|
|
self.assertEqual(combinations(3, 1, []), [[3]])
|
|
|
|
def test_4(self):
|
|
self.assertEqual(combinations(4, 1, []), [[4]])
|
|
|
|
def test_5(self):
|
|
self.assertEqual(combinations(5, 1, []), [[5]])
|
|
|
|
def test_6(self):
|
|
self.assertEqual(combinations(6, 1, []), [[6]])
|
|
|
|
def test_7(self):
|
|
self.assertEqual(combinations(7, 1, []), [[7]])
|
|
|
|
def test_8(self):
|
|
self.assertEqual(combinations(8, 1, []), [[8]])
|
|
|
|
def test_9(self):
|
|
self.assertEqual(combinations(9, 1, []), [[9]])
|
|
|
|
def test_cage_with_sum_45_contains_all_digits_1_9(self):
|
|
self.assertEqual(combinations(45, 9, []), [[1, 2, 3, 4, 5, 6, 7, 8, 9]])
|
|
|
|
def test_cage_with_only_1_possible_combination(self):
|
|
self.assertEqual(combinations(7, 3, []), [[1, 2, 4]])
|
|
|
|
def test_cage_with_several_combinations(self):
|
|
self.assertEqual(combinations(10, 2, []), [[1, 9], [2, 8], [3, 7], [4, 6]])
|
|
|
|
def test_cage_with_several_combinations_that_is_restricted(self):
|
|
self.assertEqual(combinations(10, 2, [1, 4]), [[2, 8], [3, 7]])
|