From: Eevee Date: Sat, 13 Dec 2008 04:02:00 +0000 (-0800) Subject: Turned original test puzzle into a real testcase. X-Git-Url: http://git.veekun.com/pseudoku.git/commitdiff_plain/bbf0c8e40c0b3205d7e8e0ec83e13374a0bf7f56 Turned original test puzzle into a real testcase. Runnable via setuptools, too: python setup.py test --- diff --git a/pseudoku/tests/__init__.py b/pseudoku/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pseudoku/tests/integrity/__init__.py b/pseudoku/tests/integrity/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pseudoku/tests/integrity/simple.py b/pseudoku/tests/integrity/simple.py new file mode 100644 index 0000000..c85f206 --- /dev/null +++ b/pseudoku/tests/integrity/simple.py @@ -0,0 +1,24 @@ +from unittest import TestCase + +from pseudoku.grid import Grid + +class SimpleGridTestCase(TestCase): + """Tests the solving integrity of some puzzles that can be solved using + only elimination and uniqueness. + """ + + def _test_single_puzzle(self, puzzle, msg=None): + """Solves a single puzzle and verifies that the result is, at least, + not incorrect. + """ + + grid = Grid.from_string(puzzle) + grid.solve() + self.assertTrue(grid.is_filled(), msg) + + def test_simple(self): + self._test_single_puzzle(""" + ...69.... 9.5..876. ..4..1.2. + 6...5...3 38.....49 7...3...2 + .7.9..3.. .231..4.8 ....83... + """) diff --git a/setup.py b/setup.py index 8d834ec..76cf91c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,9 @@ from setuptools import setup, find_packages setup( name = 'Pseudoku', version = '0.0', - packages = find_packages(exclude=['tests', 'tests.*']), + packages = find_packages(exclude=['pseudoku.tests', 'pseudoku.tests.*']), + + test_suite = 'pseudoku.tests', entry_points = { 'console_scripts': [