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

Method test_range_format_unified

Lib/test/test_difflib.py:336–351  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

334 self.assertEqual(list(cd)[0:2], ["*** Original", "--- Current"])
335
336 def test_range_format_unified(self):
337 # Per the diff spec at http://www.unix.org/single_unix_specification/
338 spec = '''\
339 Each <range> field shall be of the form:
340 %1d", <beginning line number> if the range contains exactly one line,
341 and:
342 "%1d,%1d", <beginning line number>, <number of lines> otherwise.
343 If a range is empty, its beginning line number shall be the number of
344 the line just before the range, or 0 if the empty range starts the file.
345 ''&#x27;
346 fmt = difflib._format_range_unified
347 self.assertEqual(fmt(3,3), '3,0')
348 self.assertEqual(fmt(3,4), '4')
349 self.assertEqual(fmt(3,5), '4,2')
350 self.assertEqual(fmt(3,6), '4,3')
351 self.assertEqual(fmt(0,0), '0,0')
352
353 def test_range_format_context(self):
354 # Per the diff spec at http://www.unix.org/single_unix_specification/

Callers

nothing calls this directly

Calls 2

fmtFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected