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 parse_absolute_datings(): for macrogenetic_file in faust.macrogenesis_files(): tree = etree.parse(macrogenetic_file) # type: etree._ElementTree for date_el in tree.xpath( '//f:date', namespaces=faust.namespaces): # type: etree._Element try: abs_dating = AbsoluteDating( when=date_el.get('when'), from_=date_el.get('from'), to=date_el.get('to'), not_before=date_el.get('notBefore'), not_after=date_el.get('notAfter'), bibliographic_source=date_el.xpath( 'f:source/@uri', namespaces=faust.namespaces)) comment = "|".join( date_el.xpath('f:comment/text()', namespaces=faust.namespaces)) for uri in date_el.xpath('f:item/@uri', namespaces=faust.namespaces): wit = Witness.get(uri) yield abs_dating, comment, wit except Exception: logging.exception('Problem parsing %s', etree.tostring(date_el))
def test_missing_inscription_wit(fake_db): Witness.database = fake_db i = Witness.get('faust://inscription/wa/XXX/gipsnich') assert isinstance(i, Inscription) assert i.status == "unknown"
def test_ex_inscription(fake_db): Witness.database = fake_db i = Witness.get('faust://inscription/wa/2_H/i_uebrige') assert isinstance(i, Inscription)
def test_missing_stuff(fake_db): Witness.database = fake_db w = Witness.get('faust://document/fstedtn/2_H') assert w.status == 'unknown'
def test_other_uri(fake_db): Witness.database = fake_db h = Witness.get('faust://document/wa/2_H') assert isinstance(h, Witness) assert h.uri == 'faust://document/faustedition/2_H' assert h.status == '(ok)'
def fake_db(fake_json): return Witness.build_database(fake_json)