MCPcopy Index your code
hub / github.com/python/mypy / test_render_diff_range

Method test_render_diff_range

mypy/test/meta/test_diff_helper.py:7–30  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5
6class DiffHelperSuite(Suite):
7 def test_render_diff_range(self) -> None:
8 expected = ["hello", "world"]
9 actual = ["goodbye", "world"]
10
11 expected_ranges, actual_ranges = diff_ranges(expected, actual)
12
13 output = io.StringIO()
14 render_diff_range(expected_ranges, expected, output=output)
15 assert output.getvalue() == " hello (diff)\n world\n"
16 output = io.StringIO()
17 render_diff_range(actual_ranges, actual, output=output)
18 assert output.getvalue() == " goodbye (diff)\n world\n"
19
20 expected = ["a", "b", "c", "d", "e", "f", "g", "h", "circle", "i", "j"]
21 actual = ["a", "b", "c", "d", "e", "f", "g", "h", "square", "i", "j"]
22
23 expected_ranges, actual_ranges = diff_ranges(expected, actual)
24
25 output = io.StringIO()
26 render_diff_range(expected_ranges, expected, output=output, indent=0)
27 assert output.getvalue() == "a\nb\nc\n...\nf\ng\nh\ncircle (diff)\ni\nj\n"
28 output = io.StringIO()
29 render_diff_range(actual_ranges, actual, output=output, indent=0)
30 assert output.getvalue() == "a\nb\nc\n...\nf\ng\nh\nsquare (diff)\ni\nj\n"
31
32 def test_diff_ranges(self) -> None:
33 a = ["hello", "world"]

Callers

nothing calls this directly

Calls 2

diff_rangesFunction · 0.90
render_diff_rangeFunction · 0.90

Tested by

no test coverage detected