stoichiograph

Spell words with elemental symbols from the periodic table.
git clone git://git.amin.space/stoichiograph.git
Log | Files | Refs | LICENSE

conftest.py (1721B)


      1 from collections import defaultdict
      2 import pytest
      3 from stoichiograph.speller import Graph, Node
      4 
      5 
      6 @pytest.fixture()
      7 def test_graph():
      8     """Return a `speller.Graph` object of the word 'because'."""
      9     test_graph = Graph()
     10 
     11     test_graph._parents_of = defaultdict(
     12         set,
     13         {
     14             Node(value='c', position=2): {Node(value='be', position=0)},
     15             Node(value='au', position=3): {Node(value='c', position=2)},
     16             Node(value='s', position=5): {
     17                 Node(value='au', position=3),
     18                 Node(value='u', position=4)
     19             },
     20             Node(value='se', position=5): {
     21                 Node(value='au', position=3),
     22                 Node(value='u', position=4)
     23             },
     24             None: {Node(value='se', position=5)},
     25             Node(value='ca', position=2): {Node(value='be', position=0)},
     26             Node(value='u', position=4): {Node(value='ca', position=2)}
     27         }
     28     )
     29 
     30     test_graph._children_of = defaultdict(
     31         set,
     32         {
     33             None: {Node(value='be', position=0), Node(value='b', position=0)},
     34             Node(value='be', position=0): {
     35                 Node(value='ca', position=2),
     36                 Node(value='c', position=2)
     37             },
     38             Node(value='c', position=2): {Node(value='au', position=3)},
     39             Node(value='au', position=3): {
     40                 Node(value='se', position=5),
     41                 Node(value='s', position=5)
     42             },
     43             Node(value='ca', position=2): {Node(value='u', position=4)},
     44             Node(value='u', position=4): {
     45                 Node(value='se', position=5),
     46                 Node(value='s', position=5)
     47             }
     48         }
     49     )
     50 
     51     return test_graph