aws-samples / amazon-textract-response-parser

Parse JSON response of Amazon Textract
Apache License 2.0
220 stars 96 forks source link

Fix tests for indexes not being in sync #128

Closed schadem closed 1 year ago

schadem commented 1 year ago

Issue #, if available: fixes #127

Description of changes: Fixing delete_blocks, which deleted lower index numbers, which shifted the items and then deleted the wrong indexes Fixing adding update of indexes after add_blocks Fixing block ordering, which updates the index now as well

all tests work, but the design has a problem with keeping the index and the blocks array in sync. Python does not have a listener for array changes, so this is still a potential for failure if someone manipulates the TDocument.blocks array without calling __post_init__().

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.