def test_generate_sparse_matrix_equals_to_paper_example(): db.replace_all_nodes(paper_nodes) db.replace_all_paths(paper_paths) db.replace_all_templates(paper_templates) index_parser.generate_sparse_matrix() assert paper_matrix == db.get_sparse_matrix()
def parse(): clean() from app.graph_parser import graph_parser from app.index_parser import index_parser graph_parser.parse('example-rdfs/tall/paper.nt') # graph_parser.parse('example-rdfs/venti/linkedmdb-latest-dump.nt') graph_parser.persist_index() index_parser.generate_sparse_matrix() clean()
def test_generate_sparse_matrix_loops_all_nodes_for_each_paths(monkeypatch): counters = mock_method_with_counter(monkeypatch, db, 'get_node') nodes, paths, templates = create_indexes() index_parser.generate_sparse_matrix() assert len(paths) * len(nodes) == counters['invocations']
def test_generate_sparse_matrix_clears_old_sparse_matrix(monkeypatch): counters = mock_method_with_counter(monkeypatch, db, 'clear_sparse_matrix') index_parser.generate_sparse_matrix() assert 1 == counters['invocations']