r""" Format "?" output and deal with tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print(repr(line))
(self, aline, bline, atags, btags)
| 997 | yield from g |
| 998 | |
| 999 | def _qformat(self, aline, bline, atags, btags): |
| 1000 | r""" |
| 1001 | Format "?" output and deal with tabs. |
| 1002 | |
| 1003 | Example: |
| 1004 | |
| 1005 | >>> d = Differ() |
| 1006 | >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', |
| 1007 | ... ' ^ ^ ^ ', ' ^ ^ ^ ') |
| 1008 | >>> for line in results: print(repr(line)) |
| 1009 | ... |
| 1010 | '- \tabcDefghiJkl\n' |
| 1011 | '? \t ^ ^ ^\n' |
| 1012 | '+ \tabcdefGhijkl\n' |
| 1013 | '? \t ^ ^ ^\n' |
| 1014 | """ |
| 1015 | atags = _keep_original_ws(aline, atags).rstrip() |
| 1016 | btags = _keep_original_ws(bline, btags).rstrip() |
| 1017 | |
| 1018 | yield "- " + aline |
| 1019 | if atags: |
| 1020 | yield f"? {atags}\n" |
| 1021 | |
| 1022 | yield "+ " + bline |
| 1023 | if btags: |
| 1024 | yield f"? {btags}\n" |
| 1025 | |
| 1026 | # With respect to junk, an earlier version of ndiff simply refused to |
| 1027 | # *start* a match with a junk element. The result was cases like this: |
no test coverage detected