Skip to content

Commit

Permalink
Version 0.3.1
Browse files Browse the repository at this point in the history
Some more tests, README update and som documentation fixes.
  • Loading branch information
hbldh committed Oct 8, 2015
1 parent 3df0a09 commit 607630d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Tests can be run using `nosetests`:

## Usage

An sudoku can be solved as such:
An Sudoku can be solved as such:

```python
from hbldhdoku import Sudoku
Expand All @@ -30,7 +30,7 @@ print(s)

```

A sudouko file should be structured as such:
A Sudoku file should be structured in the following manner:

# Optional comment or metadata
*72****6*
Expand Down
2 changes: 1 addition & 1 deletion hbldhdoku/sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def solve(self, verbose=False):
# Found some uniquely defined. Run another iteration to see if new ones have shown up.
continue
else:
# Could not
# Could not solve this Sudoku.
print(self.matrix)
raise SudokuException("This Sudoku requires more advanced methods!")
if verbose:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

setup(
name='hbldhdoku',
version='0.3.0',
version='0.3.1',
author='Henrik Blidh',
author_email='henrik.blidh@nedomkull.com',
description='Sudoku Solver',
Expand Down
10 changes: 9 additions & 1 deletion tests/test_sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_solve_medium_sudoku(self):

def test_solve_hard_sudoku(self):
s = Sudoku.load_sudoku(os.path.join(self.test_dir, 'hard.sud'))
s.solve()
s.solve(verbose=True)
correct_solution = Sudoku.load_sudoku(os.path.join(self.test_dir, 'hard_sol.sud'))
assert s == correct_solution

Expand All @@ -56,3 +56,11 @@ def test_raises_error_when_unsolvable(self):
s = Sudoku.load_sudoku(os.path.join(self.test_dir, 'hard.sud'))
s.matrix[0][0] = 2
s.solve()

def test_equality(self):
s = Sudoku.load_sudoku(os.path.join(self.test_dir, 'hard_sol.sud'))
s2 = Sudoku.load_sudoku(os.path.join(self.test_dir, 'medium_sol.sud'))
s3 = Sudoku.load_sudoku(os.path.join(self.test_dir, 'hard_sol.sud'))
assert s != s2
assert s == s3

0 comments on commit 607630d

Please sign in to comment.