Example #1
0
 def final_node_query(self, node_index):
     col = db.get_column(node_index)
     paths = []
     for path_index, t in col.items():
         if t[0] == (t[1] - 1):
             paths.append(db.get_path(path_index))
     return paths
Example #2
0
def test_read_sparse_matrix_column_returns_dict_of_size_three_lists():
    db.clear_sparse_matrix()
    db.store_tuple(0, 0, [1, 2, 3])
    db.store_tuple(2, 0, [2, 3, 4])
    col = db.get_column(0)
    assert isinstance(col, dict)
    assert isinstance(col[0], list)
    with pytest.raises(KeyError):
        col[1]
    assert isinstance(col[2], list)
    assert 3 == len(col[0])
    assert 3 == len(col[2])
Example #3
0
 def node_query(self, node_index):
     col = db.get_column(node_index)
     paths = []
     for path_index in col.keys():
         paths.append(db.get_path(path_index))
     return paths
Example #4
0
def test_read_sparse_matrix_column_out_of_range_returns_None():
    db.clear_sparse_matrix()
    assert None == db.get_column(3)