This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some simple unit tests for sanity.
- Loading branch information
1 parent
a8a949f
commit b805269
Showing
2 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from collections import defaultdict | ||
import pytest | ||
from speller import Graph, Node | ||
|
||
|
||
@pytest.fixture() | ||
def test_graph(): | ||
"""Return a `speller.Graph` object of the word 'because'.""" | ||
test_graph = Graph() | ||
|
||
test_graph._parents_of = defaultdict( | ||
set, | ||
{ | ||
Node(value='c', position=2): {Node(value='be', position=0)}, | ||
Node(value='au', position=3): {Node(value='c', position=2)}, | ||
Node(value='s', position=5): { | ||
Node(value='au', position=3), | ||
Node(value='u', position=4) | ||
}, | ||
Node(value='se', position=5): { | ||
Node(value='au', position=3), | ||
Node(value='u', position=4) | ||
}, | ||
None: {Node(value='se', position=5)}, | ||
Node(value='ca', position=2): {Node(value='be', position=0)}, | ||
Node(value='u', position=4): {Node(value='ca', position=2)} | ||
} | ||
) | ||
|
||
test_graph._children_of = defaultdict( | ||
set, | ||
{ | ||
None: {Node(value='be', position=0), Node(value='b', position=0)}, | ||
Node(value='be', position=0): { | ||
Node(value='ca', position=2), | ||
Node(value='c', position=2) | ||
}, | ||
Node(value='c', position=2): {Node(value='au', position=3)}, | ||
Node(value='au', position=3): { | ||
Node(value='se', position=5), | ||
Node(value='s', position=5) | ||
}, | ||
Node(value='ca', position=2): {Node(value='u', position=4)}, | ||
Node(value='u', position=4): { | ||
Node(value='se', position=5), | ||
Node(value='s', position=5) | ||
} | ||
} | ||
) | ||
|
||
return test_graph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters