jjmccollum / teiphy

A Python package for converting TEI XML collations to NEXUS, BEAST 2.7 XML, and other formats
MIT License
11 stars 3 forks source link

add unit tests #7

Closed rbturnbull closed 2 years ago

rbturnbull commented 2 years ago

Hi @jjmccollum - i'm trying to get the example to run. I want to put it in a unit test ultimately. I fixed up a couple of issues but it's dying here:

Skipping unknown witness siglum 03 (base siglum 03) in variation unit B10K1V1U24-26, reading 2... Traceback (most recent call last): File "/Users/rturnbull/Documents/Joey/tei-collation-converter/py/convert_tei.py", line 53, in main() File "/Users/rturnbull/Documents/Joey/tei-collation-converter/py/convert_tei.py", line 47, in main coll = collation(xml, manuscript_suffixes, trivial_reading_types, missing_reading_types, fill_corrector_lacunae, verbose) File "/Users/rturnbull/Documents/Joey/tei-collation-converter/py/tei_collation_converter.py", line 365, in init self.parse_readings_by_witness() File "/Users/rturnbull/Documents/Joey/tei-collation-converter/py/tei_collation_converter.py", line 513, in parse_readings_by_witness readings_by_witness_for_unit = self.get_readings_by_witness_for_unit(vu, verbose) File "/Users/rturnbull/Documents/Joey/tei-collation-converter/py/tei_collation_converter.py", line 469, in get_readings_by_witness_for_unit rdg_support[reading_id_to_index[t]] += rdg.certainties[t] KeyError: 'W1/2'

jjmccollum commented 2 years ago

Which command are you using with convert_tei.py? Is it

python py\convert_tei.py -t reconstructed -t defective -t orthographic -t subreading -m lac -m overlap -t "*" -t "T" -t "/1" -t "/2" -t "/3" --fill-correctors --verbose example\ubs_ephesians.xml ubs_ephesians.nxs

from the readme, or something else? I can try to reproduce the error.

jjmccollum commented 2 years ago

I got the same error with the minimal test python py\convert_tei.py --verbose example\ubs_ephesians.xml ubs_ephesians.nxs. It looks like the issue was how the code handles witDetail witnesses without @target attributes (e.g., overlap and lac instances). I've fixed the issue and pushed the code that makes this minimal test work. (Sorry I keep pushing changes on main; I know it's bad practice, but it's easy to do before the code has gone public!)

rbturnbull commented 2 years ago

great work Joey :)