1: A file with several lines of text.
2: To be used by the diff module test.
3: This line is changed.
4: A NEW LINE INSERTED.
5: The diff module is used to compare and patch test files.
6:
Start python section to interscript/tests/test_diff.py[1
/1
]
1: #line 191 "diff.ipk"
2: import sys
3: import string
4: sys.path = [''] + sys.path
5: import interscript.utilities.diff
6: diff = interscript.utilities.diff
7: cmp = diff.compare_files('diff1.dat', 'diff1.dat')
8: assert cmp
9: cmp = diff.compare_files('diff1.dat', 'diff2.dat')
10: assert not cmp
11: patch = diff.diff_files('diff1.dat','diff2.dat')
12: print 'patch below'
13: print patch
14: print
15: diff.patch_file('diff1.dat',patch,'diff3.dat')
16: cmp = diff.compare_files('diff2.dat','diff3.dat')
17: assert cmp
18: f = open('diff1.dat')
19: d1 = f.readlines()
20: f.close()
21: for i in range(len(d1)): d1[i] = string.rstrip(d1[i])
22: f = open('diff2.dat')
23: d2 = f.readlines()
24: for i in range(len(d2)): d2[i] = string.rstrip(d2[i])
25: f.close()
26:
27: d = diff.diff_lines(d1,d2)
28: for section in d:
29: print '*****'
30: for part in section:
31: print part
32:
7: Now run it.
Start output section of "/usr/local/bin/python" interscript/tests/test_diff.py
Command returned 256
1: diff: diff1.dat: No such file or directory
2: diff: diff1.dat: No such file or directory
3: diff: diff2.dat: No such file or directory
4: Interscript version 1.0a8 build 1384
5: Built by root on ruby at Mon Nov 30, 1998 at 08:56 AM (UTC)
6: Generated by 1.0a8 buildno 1383 host ruby
7: at Mon Nov 30, 1998 at 08:56 AM (UTC)
8: Traceback (innermost last):
9: File "interscript/tests/test_diff.py", line 10, in ?
10: assert not cmp
11: AssertionError
8: