示例#1
0
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()
示例#2
0
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()
示例#3
0
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']
示例#4
0
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']