MCPcopy Index your code
hub / github.com/python/cpython / _do_a_fancy_diff

Method _do_a_fancy_diff

Lib/doctest.py:1794–1815  ·  view source on GitHub ↗
(self, want, got, optionflags)

Source from the content-addressed store, hash-verified

1792
1793 # Should we do a fancy diff?
1794 def _do_a_fancy_diff(self, want, got, optionflags):
1795 # Not unless they asked for a fancy diff.
1796 if not optionflags & (REPORT_UDIFF |
1797 REPORT_CDIFF |
1798 REPORT_NDIFF):
1799 return False
1800
1801 # If expected output uses ellipsis, a meaningful fancy diff is
1802 # too hard ... or maybe not. In two real-life failures Tim saw,
1803 # a diff was a major help anyway, so this is commented out.
1804 # [todo] _ellipsis_match() knows which pieces do and don't match,
1805 # and could be the basis for a kick-ass diff in this case.
1806 ##if optionflags & ELLIPSIS and ELLIPSIS_MARKER in want:
1807 ## return False
1808
1809 # ndiff does intraline difference marking, so can be useful even
1810 # for 1-line differences.
1811 if optionflags & REPORT_NDIFF:
1812 return True
1813
1814 # The other diff types need at least a few lines to be helpful.
1815 return want.count('\n') > 2 and got.count('\n') > 2
1816
1817 def output_difference(self, example, got, optionflags):
1818 """

Callers 1

output_differenceMethod · 0.95

Calls 1

countMethod · 0.45

Tested by

no test coverage detected