Reconstruct the actual output from my unit test tool report
When a test fails, my unit test tool reports differences between the actual output and the expected output as follow: - line in the expected output but missing in the actual output are prefixed with a dash - unexpected lines in the actual output are prefixed with a plus sign - comments added by the unit test tool are prefixed with a question mark - common lines are showed `as-is` (well, almost;) From that "diff" format, I would like to reconstruct the actual output.
Start file
{'claims': [{'add': '',
- 'mainsnak': {'property': 'P31',
+ 'mainsnak': {'datatype': 'wikibase-item',
+ 'datavalue': {'type': 'wikibase-entityid',
+ 'value': {'entity-type': 'item',
+ 'id': 'Q5',
+ 'numeric-id': 5}},
+ 'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
+ 'property': 'P31',
- 'snaktype': 'value',
+ 'snaktype': 'value'},
? +
- 'value': {'entity-type': 'item', 'id': 'Q5'}},
+ 'qualifiers': {},
'rank': 'normal',
'type': 'statement'}],
'id': 'Q44',
'ns': 0}
End file
{'claims': [{'add': '',
'mainsnak': {'datatype': 'wikibase-item',
'datavalue': {'type': 'wikibase-entityid',
'value': {'entity-type': 'item',
'id': 'Q5',
'numeric-id': 5}},
'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
'property': 'P31',
'snaktype': 'value'},
'qualifiers': {},
'rank': 'normal',
'type': 'statement'}],
'id': 'Q44',
'ns': 0}
View Diff
1,12c1,9
< {'claims': [{'add': '',
< - 'mainsnak': {'property': 'P31',
< + 'mainsnak': {'datatype': 'wikibase-item',
< + 'datavalue': {'type': 'wikibase-entityid',
< + 'value': {'entity-type': 'item',
< + 'id': 'Q5',
< + 'numeric-id': 5}},
< + 'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
< + 'property': 'P31',
< - 'snaktype': 'value',
< + 'snaktype': 'value'},
< ? +
---
> {'claims': [{'add': '',
> 'mainsnak': {'datatype': 'wikibase-item',
> 'datavalue': {'type': 'wikibase-entityid',
> 'value': {'entity-type': 'item',
> 'id': 'Q5',
> 'numeric-id': 5}},
> 'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
> 'property': 'P31',
> 'snaktype': 'value'},
14,19c11,15
< - 'value': {'entity-type': 'item', 'id': 'Q5'}},
< + 'qualifiers': {},
< 'rank': 'normal',
< 'type': 'statement'}],
< 'id': 'Q44',
< 'ns': 0}
---
> 'qualifiers': {},
> 'rank': 'normal',
> 'type': 'statement'}],
> 'id': 'Q44',
> 'ns': 0}
Solutions by @wansmer:
Unlock 3 remaining solutions by signing in and submitting your own entry