@@ -28,6 +28,12 @@ def setUp(self):
28
28
with open ("tests/casefiles/tzu" ) as f :
29
29
self .tzu = f .read ().splitlines ()
30
30
31
+ with open ("tests/casefiles/abc" ) as f :
32
+ self .abc = f .read ().splitlines ()
33
+
34
+ with open ("tests/casefiles/efg" ) as f :
35
+ self .efg = f .read ().splitlines ()
36
+
31
37
def test_truth (self ):
32
38
self .assertEqual (type (self .lao ), list )
33
39
self .assertEqual (type (self .tzu ), list )
@@ -55,6 +61,13 @@ def test_diff_unified(self):
55
61
self .assertEqual (_apply (self .lao , diff_text ), self .tzu )
56
62
self .assertEqual (_apply_r (self .tzu , diff_text ), self .lao )
57
63
64
+ def test_diff_unified2 (self ):
65
+ with open ("tests/casefiles/diff-unified2.diff" ) as f :
66
+ diff_text = f .read ()
67
+
68
+ self .assertEqual (_apply (self .abc , diff_text ), self .efg )
69
+ self .assertEqual (_apply_r (self .efg , diff_text ), self .abc )
70
+
58
71
def test_diff_unified_bad (self ):
59
72
with open ("tests/casefiles/diff-unified-bad.diff" ) as f :
60
73
diff_text = f .read ()
@@ -129,6 +142,22 @@ def test_diff_unified_patchutil(self):
129
142
with pytest .raises (exceptions .ApplyException ):
130
143
_apply (["" ] + self .lao , diff_text , use_patch = True )
131
144
145
+ def test_diff_unified2_patchutil (self ):
146
+ with open ("tests/casefiles/diff-unified2.diff" ) as f :
147
+ diff_text = f .read ()
148
+
149
+ if not which ("patch" ):
150
+ raise SkipTest ()
151
+
152
+ self .assertEqual (_apply (self .abc , diff_text , use_patch = True ),
153
+ (self .efg , None ))
154
+ self .assertEqual (_apply (self .abc , diff_text , use_patch = True ),
155
+ (_apply (self .abc , diff_text ), None ))
156
+ self .assertEqual (_apply_r (self .efg , diff_text , use_patch = True ),
157
+ (self .abc , None ))
158
+ self .assertEqual (_apply_r (self .efg , diff_text , use_patch = True ),
159
+ (_apply_r (self .efg , diff_text ), None ))
160
+
132
161
def test_diff_rcs (self ):
133
162
with open ("tests/casefiles/diff-rcs.diff" ) as f :
134
163
diff_text = f .read ()
0 commit comments