|
@@ -423,7 +423,7 @@ class UnifiedDiffTest(unittest.TestCase):
|
423
|
423
|
|
424
|
424
|
class DiffParserTest(unittest.TestCase):
|
425
|
425
|
|
426
|
|
- def test_type_detect(self):
|
|
426
|
+ def test_type_detect_unified(self):
|
427
|
427
|
patch = """\
|
428
|
428
|
spam
|
429
|
429
|
--- a
|
|
@@ -435,6 +435,21 @@ spam
|
435
|
435
|
parser = cdiff.DiffParser(stream)
|
436
|
436
|
self.assertEqual(parser._type, 'unified')
|
437
|
437
|
|
|
438
|
+ def test_type_detect_context(self):
|
|
439
|
+ patch = """\
|
|
440
|
+*** /path/to/original timestamp
|
|
441
|
+--- /path/to/new timestamp
|
|
442
|
+***************
|
|
443
|
+*** 1,1 ****
|
|
444
|
+--- 1,2 ----
|
|
445
|
++ This is an important
|
|
446
|
+ This part of the
|
|
447
|
+"""
|
|
448
|
+ items = patch.splitlines(True)
|
|
449
|
+ stream = cdiff.PatchStream(Sequential(items))
|
|
450
|
+ parser = cdiff.DiffParser(stream)
|
|
451
|
+ self.assertEqual(parser._type, 'context')
|
|
452
|
+
|
438
|
453
|
def test_type_detect_neg(self):
|
439
|
454
|
patch = """\
|
440
|
455
|
spam
|