/
test_main.py
28 lines (21 loc) · 1000 Bytes
/
test_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import networkx as nx
import pytest
from macrogen.datings import BiblSource
from macrogen.graph import collapse_edges
from macrogen.uris import Witness
@pytest.fixture
def conflict_03():
c41 = Witness.get('faust://document/wa_faust/C_41')
c4 = Witness.get('faust://document/wa_faust/C_4')
q = Witness.get('faust://document/wa_faust/Q')
G = nx.MultiDiGraph()
G.add_edge(c41, c4, source=BiblSource('faust://bibliography/wa_i_15_2', '1'))
G.add_edge(c4, c41,source=BiblSource('faust://bibliography/wa_i_15_2', '2'))
G.add_edge(c41, q, source=BiblSource('faust://bibliography/wa_i_15_2', '3'))
G.add_edge(c41, q, source=BiblSource('faust://bibliography/wa_i_15_2', '2'))
G.add_edge(c41, q, source=BiblSource('faust://bibliography/wa_i_15_2', '3'))
G.add_edge(q, c41, source=BiblSource('faust://bibliography/wa_i_15_2', '4'))
return G
def test_collapse_edges(conflict_03):
collapsed = collapse_edges(conflict_03)
assert len(collapsed.edges) == 2