mirror of https://github.com/python/cpython
Remove test_difflib's output file and change test_difflib to stop
generating it. Since this is purely a doctest, the output file never served a good purpose.
This commit is contained in:
parent
07f353c560
commit
dec4a6143c
|
@ -1,280 +0,0 @@
|
|||
test_difflib
|
||||
Running difflib.__doc__
|
||||
Trying: get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
|
||||
Expecting: ['apple', 'ape']
|
||||
ok
|
||||
Trying: import keyword
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: get_close_matches("wheel", keyword.kwlist)
|
||||
Expecting: ['while']
|
||||
ok
|
||||
Trying: get_close_matches("apple", keyword.kwlist)
|
||||
Expecting: []
|
||||
ok
|
||||
Trying: get_close_matches("accept", keyword.kwlist)
|
||||
Expecting: ['except']
|
||||
ok
|
||||
Trying:
|
||||
s = SequenceMatcher(lambda x: x == " ",
|
||||
"private Thread currentThread;",
|
||||
"private volatile Thread currentThread;")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: print round(s.ratio(), 3)
|
||||
Expecting: 0.866
|
||||
ok
|
||||
Trying:
|
||||
for block in s.get_matching_blocks():
|
||||
print "a[%d] and b[%d] match for %d elements" % block
|
||||
Expecting:
|
||||
a[0] and b[0] match for 8 elements
|
||||
a[8] and b[17] match for 6 elements
|
||||
a[14] and b[23] match for 15 elements
|
||||
a[29] and b[38] match for 0 elements
|
||||
ok
|
||||
Trying:
|
||||
for opcode in s.get_opcodes():
|
||||
print "%6s a[%d:%d] b[%d:%d]" % opcode
|
||||
Expecting:
|
||||
equal a[0:8] b[0:8]
|
||||
insert a[8:8] b[8:17]
|
||||
equal a[8:14] b[17:23]
|
||||
equal a[14:29] b[23:38]
|
||||
ok
|
||||
Trying: s = SequenceMatcher()
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.set_seqs("abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.set_seq1("bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.set_seq2("abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, " abcd", "abcd abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 5, 0, 9)
|
||||
Expecting: (0, 4, 5)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 5, 0, 9)
|
||||
Expecting: (1, 0, 4)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "ab", "c")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 2, 0, 1)
|
||||
Expecting: (0, 0, 0)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "abxcd", "abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.get_matching_blocks()
|
||||
Expecting: [(0, 0, 2), (3, 2, 2), (5, 4, 0)]
|
||||
ok
|
||||
Trying: a = "qabxcd"
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: b = "abycdf"
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, a, b)
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying:
|
||||
for tag, i1, i2, j1, j2 in s.get_opcodes():
|
||||
print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
|
||||
(tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
|
||||
Expecting:
|
||||
delete a[0:1] (q) b[0:0] ()
|
||||
equal a[1:3] (ab) b[0:2] (ab)
|
||||
replace a[3:4] (x) b[2:3] (y)
|
||||
equal a[4:6] (cd) b[3:5] (cd)
|
||||
insert a[6:6] () b[5:6] (f)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.quick_ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.real_quick_ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
0 of 36 examples failed in difflib.__doc__
|
||||
Running difflib.SequenceMatcher.__doc__
|
||||
0 of 0 examples failed in difflib.SequenceMatcher.__doc__
|
||||
Running difflib.SequenceMatcher.__init__.__doc__
|
||||
0 of 0 examples failed in difflib.SequenceMatcher.__init__.__doc__
|
||||
Running difflib.SequenceMatcher.find_longest_match.__doc__
|
||||
Trying: s = SequenceMatcher(None, " abcd", "abcd abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 5, 0, 9)
|
||||
Expecting: (0, 4, 5)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 5, 0, 9)
|
||||
Expecting: (1, 0, 4)
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, "ab", "c")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.find_longest_match(0, 2, 0, 1)
|
||||
Expecting: (0, 0, 0)
|
||||
ok
|
||||
0 of 6 examples failed in difflib.SequenceMatcher.find_longest_match.__doc__
|
||||
Running difflib.SequenceMatcher.get_matching_blocks.__doc__
|
||||
Trying: s = SequenceMatcher(None, "abxcd", "abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.get_matching_blocks()
|
||||
Expecting: [(0, 0, 2), (3, 2, 2), (5, 4, 0)]
|
||||
ok
|
||||
0 of 2 examples failed in difflib.SequenceMatcher.get_matching_blocks.__doc__
|
||||
Running difflib.SequenceMatcher.get_opcodes.__doc__
|
||||
Trying: a = "qabxcd"
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: b = "abycdf"
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s = SequenceMatcher(None, a, b)
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying:
|
||||
for tag, i1, i2, j1, j2 in s.get_opcodes():
|
||||
print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
|
||||
(tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
|
||||
Expecting:
|
||||
delete a[0:1] (q) b[0:0] ()
|
||||
equal a[1:3] (ab) b[0:2] (ab)
|
||||
replace a[3:4] (x) b[2:3] (y)
|
||||
equal a[4:6] (cd) b[3:5] (cd)
|
||||
insert a[6:6] () b[5:6] (f)
|
||||
ok
|
||||
0 of 4 examples failed in difflib.SequenceMatcher.get_opcodes.__doc__
|
||||
Running difflib.SequenceMatcher.quick_ratio.__doc__
|
||||
0 of 0 examples failed in difflib.SequenceMatcher.quick_ratio.__doc__
|
||||
Running difflib.SequenceMatcher.ratio.__doc__
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.quick_ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.real_quick_ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
0 of 4 examples failed in difflib.SequenceMatcher.ratio.__doc__
|
||||
Running difflib.SequenceMatcher.real_quick_ratio.__doc__
|
||||
0 of 0 examples failed in difflib.SequenceMatcher.real_quick_ratio.__doc__
|
||||
Running difflib.SequenceMatcher.set_seq1.__doc__
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.set_seq1("bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
0 of 4 examples failed in difflib.SequenceMatcher.set_seq1.__doc__
|
||||
Running difflib.SequenceMatcher.set_seq2.__doc__
|
||||
Trying: s = SequenceMatcher(None, "abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
Trying: s.set_seq2("abcd")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 1.0
|
||||
ok
|
||||
0 of 4 examples failed in difflib.SequenceMatcher.set_seq2.__doc__
|
||||
Running difflib.SequenceMatcher.set_seqs.__doc__
|
||||
Trying: s = SequenceMatcher()
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.set_seqs("abcd", "bcde")
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: s.ratio()
|
||||
Expecting: 0.75
|
||||
ok
|
||||
0 of 3 examples failed in difflib.SequenceMatcher.set_seqs.__doc__
|
||||
Running difflib.get_close_matches.__doc__
|
||||
Trying: get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
|
||||
Expecting: ['apple', 'ape']
|
||||
ok
|
||||
Trying: import keyword
|
||||
Expecting: nothing
|
||||
ok
|
||||
Trying: get_close_matches("wheel", keyword.kwlist)
|
||||
Expecting: ['while']
|
||||
ok
|
||||
Trying: get_close_matches("apple", keyword.kwlist)
|
||||
Expecting: []
|
||||
ok
|
||||
Trying: get_close_matches("accept", keyword.kwlist)
|
||||
Expecting: ['except']
|
||||
ok
|
||||
0 of 5 examples failed in difflib.get_close_matches.__doc__
|
||||
4 items had no tests:
|
||||
difflib.SequenceMatcher
|
||||
difflib.SequenceMatcher.__init__
|
||||
difflib.SequenceMatcher.quick_ratio
|
||||
difflib.SequenceMatcher.real_quick_ratio
|
||||
9 items passed all tests:
|
||||
36 tests in difflib
|
||||
6 tests in difflib.SequenceMatcher.find_longest_match
|
||||
2 tests in difflib.SequenceMatcher.get_matching_blocks
|
||||
4 tests in difflib.SequenceMatcher.get_opcodes
|
||||
4 tests in difflib.SequenceMatcher.ratio
|
||||
4 tests in difflib.SequenceMatcher.set_seq1
|
||||
4 tests in difflib.SequenceMatcher.set_seq2
|
||||
3 tests in difflib.SequenceMatcher.set_seqs
|
||||
5 tests in difflib.get_close_matches
|
||||
68 tests in 13 items.
|
||||
68 passed and 0 failed.
|
||||
Test passed.
|
|
@ -1,2 +1,2 @@
|
|||
import doctest, difflib
|
||||
doctest.testmod(difflib, verbose=1)
|
||||
doctest.testmod(difflib, verbose=0)
|
||||
|
|
Loading…
Reference in New Issue