kyu_4.validate_sudoku_with_size package

Submodules

kyu_4.validate_sudoku_with_size.sudoku module

Solution for -> Validate Sudoku with size NxN.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_4.validate_sudoku_with_size.sudoku.Sudoku(data: list)[source]

Bases: object

Sudoku class.

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, write a method to validate if it has been filled out correctly.

is_data_valid() bool[source]

Verify data validity.

Returns:

bool

is_valid() bool[source]

Sudoku validator.

A method to validate if given a Sudoku has been filled out correctly. Sudoku -> data structure with size NxN, N > 0 and √N == integer. :return: bool

kyu_4.validate_sudoku_with_size.test_sudoku module

Test for -> Validate Sudoku with size NxN.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_4.validate_sudoku_with_size.test_sudoku.SudokuTestCase(methodName='runTest')[source]

Bases: TestCase

Testing Sudoku class.

_classSetupFailed = False
_class_cleanups = []
test_sudoku_class = None
test_sudoku_class_00(**kw)

Testing Sudoku class [with data=[[1]], expected=True, message=’Testing valid 1x1’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_01(**kw)

Testing Sudoku class [with data=[[2]], expected=False, message=’Testing invalid 1x1 with wrong value’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_02(**kw)

Testing Sudoku class [with data=[[‘a’]], expected=False, message=’Testing invalid 1x1 with non-integer value’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_03(**kw)

Testing Sudoku class [with data=[[1, 2, 3], [4, 5, 6]], expected=False, message=’Testing invalid rectangular matrix 2x3’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_04(**kw)

Testing Sudoku class [with data=[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], expected=False, message=’Testing invalid non-square matrix 3x4’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_05(**kw)

Testing Sudoku class [with data=[[7, 8, 4, 1, 5, 9, 3, 2, 6], [5…8], [1, 9, 5, 2, 8, 7, 6, 3, 4]], expected=True, message=’Testing valid 9x9’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_06(**kw)

Testing Sudoku class [with data=[[1, 4, 2, 3], [3, 2, 4, 1], [4, 1, 3, 2], [2, 3, 1, 4]], expected=True, message=’Testing valid 4x4’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_07(**kw)

Testing Sudoku class [with data=[[1, 2, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 4], [1]], expected=False, message=’4x5 (invalid dimension)’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_08(**kw)

Testing Sudoku class [with data=[[0, 2, 3, 4, 5, 6, 7, 8, 9], [1…9], [1, 2, 3, 4, 5, 6, 7, 8, 9]], expected=False, message=’Values in wrong order’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_09(**kw)

Testing Sudoku class [with data=[[1, 2, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 4], [1]], expected=False, message=’4x5 (invalid dimension)’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_10(**kw)

Testing Sudoku class [with data=[[2]], expected=False, message=’1x1 with wrong value’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_11(**kw)

Testing Sudoku class [with data=[[‘’]], expected=False, message=’Empty field(s)’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_12(**kw)

Testing Sudoku class [with data=[[0]], expected=False, message=’Values not in valid range 1..N’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_13(**kw)

Testing Sudoku class [with data=[[True]], expected=False, message=’Invalid value types (boolean)’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_14(**kw)

Testing Sudoku class [with data=[[1, 4, 4, 3, ‘a’], [3, 2, 4, 1]…, 1, 4], [‘’, False, None, ‘4’]], expected=False, message=’Sudoku breaking all rules at once’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

test_sudoku_class_15(**kw)

Testing Sudoku class [with data=[[1, 2, 3, 4, 5, 6, 7, 8, 9], [2…4], [9, 7, 8, 3, 1, 2, 6, 4, 5]], expected=False, message=’Sudoku with invalid boxes (litt…es), but valid rows and columns’].

Given a Sudoku data structure with size NxN, N > 0 and √N == integer, assert a method that validates if it has been filled out correctly. :return:

Module contents

Validate Sudoku with size NxN package.