@@ -26,8 +26,7 @@ def test_diff_default(self):
26
26
with open ('tests/casefiles/diff-default.diff' ) as f :
27
27
diff_text = f .read ()
28
28
29
- diff = [x for x in wtp .parse_patch (diff_text )]
30
- diff = diff [0 ]
29
+ diff = next (wtp .parse_patch (diff_text ))
31
30
32
31
new_text = wtp .apply .apply_diff (diff , self .lao )
33
32
self .assertEqual (new_text , self .tzu )
@@ -36,8 +35,7 @@ def test_diff_context(self):
36
35
with open ('tests/casefiles/diff-context.diff' ) as f :
37
36
diff_text = f .read ()
38
37
39
- diff = [x for x in wtp .parse_patch (diff_text )]
40
- diff = diff [0 ]
38
+ diff = next (wtp .parse_patch (diff_text ))
41
39
42
40
new_text = wtp .apply .apply_diff (diff , self .lao )
43
41
self .assertEqual (new_text , self .tzu )
@@ -46,8 +44,7 @@ def test_diff_unified(self):
46
44
with open ('tests/casefiles/diff-unified.diff' ) as f :
47
45
diff_text = f .read ()
48
46
49
- diff = [x for x in wtp .parse_patch (diff_text )]
50
- diff = diff [0 ]
47
+ diff = next (wtp .parse_patch (diff_text ))
51
48
52
49
new_text = wtp .apply .apply_diff (diff , self .lao )
53
50
@@ -57,8 +54,7 @@ def test_diff_unified_patchutil(self):
57
54
with open ('tests/casefiles/diff-unified.diff' ) as f :
58
55
diff_text = f .read ()
59
56
60
- diff = [x for x in wtp .parse_patch (diff_text )]
61
- diff = diff [0 ]
57
+ diff = next (wtp .parse_patch (diff_text ))
62
58
63
59
new_text = wtp .apply .apply_diff (diff , self .lao , use_patch = True )
64
60
self .assertEqual (new_text , (self .tzu , None ))
@@ -69,8 +65,7 @@ def test_diff_rcs(self):
69
65
with open ('tests/casefiles/diff-rcs.diff' ) as f :
70
66
diff_text = f .read ()
71
67
72
- diff = [x for x in wtp .parse_patch (diff_text )]
73
- diff = diff [0 ]
68
+ diff = next (wtp .parse_patch (diff_text ))
74
69
75
70
new_text = wtp .apply .apply_diff (diff , self .lao )
76
71
self .assertEqual (new_text , self .tzu )
@@ -80,8 +75,7 @@ def test_diff_ed(self):
80
75
with open ('tests/casefiles/diff-ed.diff' ) as f :
81
76
diff_text = f .read ()
82
77
83
- diff = [x for x in wtp .parse_patch (diff_text )]
84
- diff = diff [0 ]
78
+ diff = next (wtp .parse_patch (diff_text ))
85
79
86
80
new_text = wtp .apply .apply_diff (diff , self .lao )
87
81
self .assertEqual (self .tzu ,new_text )
0 commit comments