@@ -151,7 +151,7 @@ def _run_test(self, testname):
151151 patch_tool = join (dirname (TESTS ), "patch_ng.py" )
152152 save_cwd = getcwdu ()
153153 os .chdir (tmpdir )
154- extra = "-f" if testname == "10fuzzy" else ""
154+ extra = "-f" if "10fuzzy" in testname else ""
155155 if verbose :
156156 cmd = '%s %s %s "%s"' % (sys .executable , patch_tool , extra , patch_file )
157157 print ("\n " + cmd )
@@ -425,13 +425,27 @@ def test_delete_file(self):
425425 pto .apply (strip = 0 , root = treeroot )
426426 self .assertFalse (os .path .exists (os .path .join (treeroot , 'deleted' )))
427427
428- def test_fuzzy_patch (self ):
428+ def test_fuzzy_patch_both (self ):
429429 treeroot = join (self .tmpdir , 'rootparent' )
430430 shutil .copytree (join (TESTS , '10fuzzy' ), treeroot )
431431 pto = patch_ng .fromfile (join (TESTS , '10fuzzy/10fuzzy.patch' ))
432432 self .assertTrue (pto .apply (root = treeroot , fuzz = True ))
433433 self .assertFalse (pto .apply (root = treeroot , fuzz = False ))
434434
435+ def test_fuzzy_patch_before (self ):
436+ treeroot = join (self .tmpdir , 'rootparent' )
437+ shutil .copytree (join (TESTS , '10fuzzybefore' ), treeroot )
438+ pto = patch_ng .fromfile (join (TESTS , '10fuzzybefore/10fuzzybefore.patch' ))
439+ self .assertTrue (pto .apply (root = treeroot , fuzz = True ))
440+ self .assertFalse (pto .apply (root = treeroot , fuzz = False ))
441+
442+ def test_fuzzy_patch_after (self ):
443+ treeroot = join (self .tmpdir , 'rootparent' )
444+ shutil .copytree (join (TESTS , '10fuzzyafter' ), treeroot )
445+ pto = patch_ng .fromfile (join (TESTS , '10fuzzyafter/10fuzzyafter.patch' ))
446+ self .assertTrue (pto .apply (root = treeroot , fuzz = True ))
447+ self .assertFalse (pto .apply (root = treeroot , fuzz = False ))
448+
435449
436450class TestHelpers (unittest .TestCase ):
437451 # unittest setting
0 commit comments