Browse Source

Merge pull request #74 from dimonomid/wrap_optimize

Optimize output
Matt Wang 6 years ago
parent
commit
22793881dc
No account linked to committer's email

+ 2
- 12
cdiff.py View File

149
     if tlen > width:
149
     if tlen > width:
150
         text, _, _ = strsplit(text, width - 1)
150
         text, _, _ = strsplit(text, width - 1)
151
 
151
 
152
-        # Old code always added trailing 'reset' sequence, but strsplit is
153
-        # smarter and only adds it when there is something to reset. However,
154
-        # in order not to distract with changed test data, here's workaround
155
-        # which keeps output exactly the same. TODO: remove it; it doesn't add
156
-        # any practical value for the user.
157
-        if not text.endswith(COLORS['reset']):
158
-            text += COLORS['reset']
159
-
160
         text += wrap_char
152
         text += wrap_char
161
     elif pad:
153
     elif pad:
162
         # The string is short enough, but it might need to be padded.
154
         # The string is short enough, but it might need to be padded.
549
                     out.append(COLORS['underline'] + COLORS[base_color])
541
                     out.append(COLORS['underline'] + COLORS[base_color])
550
                     text = text[2:]
542
                     text = text[2:]
551
                 elif text.startswith('\x01'):   # reset
543
                 elif text.startswith('\x01'):   # reset
552
-                    # TODO: Append resetting sequence if only there is some
553
-                    # text after that. That is, call out.append(...) if only
554
-                    # len(text) > 1.
555
-                    out.append(COLORS['reset'] + COLORS[base_color])
544
+                    if len(text) > 1:
545
+                        out.append(COLORS['reset'] + COLORS[base_color])
556
                     text = text[1:]
546
                     text = text[1:]
557
                 else:
547
                 else:
558
                     # FIXME: utf-8 wchar might break the rule here, e.g.
548
                     # FIXME: utf-8 wchar might break the rule here, e.g.

+ 5
- 5
tests/crlf/out.w70 View File

5
 @@ -3,7 +3,6 @@
5
 @@ -3,7 +3,6 @@
6
   3 ## About                                                                 3 ## About
6
   3 ## About                                                                 3 ## About
7
   4                                                                          4 
7
   4                                                                          4 
8
-  5 Coderev is a toolkit generates static side-by-side html pages for cod>   5 Coderev is a toolkit generates static side-by-side html pages for cod>
8
+  5 Coderev is a toolkit generates static side-by-side html pages for cod>   5 Coderev is a toolkit generates static side-by-side html pages for cod>
9
   6 Typical use case is to generate diff pages for local modification in >     
9
   6 Typical use case is to generate diff pages for local modification in >     
10
   7 workspace and send page link to teammates for code review.               6 workspace and send page link to teammates for code review.
10
   7 workspace and send page link to teammates for code review.               6 workspace and send page link to teammates for code review.
11
   8                                                                          7 
11
   8                                                                          7 
12
-  9 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>   8 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>
12
+  9 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>   8 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>
13
 @@ -18,9 +17,10 @@
13
 @@ -18,9 +17,10 @@
14
  18                                                                         17 
14
  18                                                                         17 
15
  19 ## Usage of coderev.sh                                                  18 ## Usage of coderev.sh
15
  19 ## Usage of coderev.sh                                                  18 ## Usage of coderev.sh
18
  22                                                                         21 
18
  22                                                                         21 
19
  23     Usage:                                                              22     Usage:
19
  23     Usage:                                                              22     Usage:
20
                                                                             23 
20
                                                                             23 
21
- 24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>  24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>
21
+ 24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>  24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>
22
  25                 [-F comment-file | -m 'comment...'] [file...]           25                 [-F comment-file | -m 'comment...'] [file...]
22
  25                 [-F comment-file | -m 'comment...'] [file...]           25                 [-F comment-file | -m 'comment...'] [file...]
23
  26                                                                         26 
23
  26                                                                         26 
24
 @@ -145,3 +145,5 @@
24
 @@ -145,3 +145,5 @@
25
-145                             specify column number where lines are bro> 145                             specify column number where lines are bro>
26
-146                             wrapped for sdiff, default is no line wra> 146                             wrapped for sdiff, default is no line wra>
25
+145                             specify column number where lines are bro> 145                             specify column number where lines are bro>
26
+146                             wrapped for sdiff, default is no line wra> 146                             wrapped for sdiff, default is no line wra>
27
 147     -y, --yes             do not prompt for overwriting                147     -y, --yes             do not prompt for overwriting
27
 147     -y, --yes             do not prompt for overwriting                147     -y, --yes             do not prompt for overwriting
28
                                                                            148 
28
                                                                            148 
29
                                                                            149 # EOF
29
                                                                            149 # EOF

+ 1
- 1
tests/diff-ru-bin/out.side-by-side View File

14
 --- a/foo.txt	2013-02-23 19:55:03.000000000 +0800
14
 --- a/foo.txt	2013-02-23 19:55:03.000000000 +0800
15
 +++ b/foo.txt	2013-02-23 19:55:10.000000000 +0800
15
 +++ b/foo.txt	2013-02-23 19:55:10.000000000 +0800
16
 @@ -1,2 +1,2 @@
16
 @@ -1,2 +1,2 @@
17
-1 Hello                                                                            1 hella
17
+1 Hello                                                                            1 hella
18
 2 world                                                                            2 world
18
 2 world                                                                            2 world

+ 1
- 1
tests/diff-ru-bin/out.w70 View File

14
 --- a/foo.txt	2013-02-23 19:55:03.000000000 +0800
14
 --- a/foo.txt	2013-02-23 19:55:03.000000000 +0800
15
 +++ b/foo.txt	2013-02-23 19:55:10.000000000 +0800
15
 +++ b/foo.txt	2013-02-23 19:55:10.000000000 +0800
16
 @@ -1,2 +1,2 @@
16
 @@ -1,2 +1,2 @@
17
-1 Hello                                                                  1 hella
17
+1 Hello                                                                  1 hella
18
 2 world                                                                  2 world
18
 2 world                                                                  2 world

+ 2
- 2
tests/diff-ru/out.side-by-side View File

15
 --- a/common/foo.txt	2013-02-22 20:28:32.000000000 +0800
15
 --- a/common/foo.txt	2013-02-22 20:28:32.000000000 +0800
16
 +++ b/common/foo.txt	2013-02-22 20:30:18.000000000 +0800
16
 +++ b/common/foo.txt	2013-02-22 20:30:18.000000000 +0800
17
 @@ -1 +1 @@
17
 @@ -1 +1 @@
18
-1 Hello                                                                            1 world
18
+1 Hello                                                                            1 world
19
 Only in b: date.txt
19
 Only in b: date.txt
20
 Only in a: time.txt
20
 Only in a: time.txt
21
-
21
+

+ 2
- 2
tests/diff-ru/out.w70 View File

15
 --- a/common/foo.txt	2013-02-22 20:28:32.000000000 +0800
15
 --- a/common/foo.txt	2013-02-22 20:28:32.000000000 +0800
16
 +++ b/common/foo.txt	2013-02-22 20:30:18.000000000 +0800
16
 +++ b/common/foo.txt	2013-02-22 20:30:18.000000000 +0800
17
 @@ -1 +1 @@
17
 @@ -1 +1 @@
18
-1 Hello                                                                  1 world
18
+1 Hello                                                                  1 world
19
 Only in b: date.txt
19
 Only in b: date.txt
20
 Only in a: time.txt
20
 Only in a: time.txt
21
-
21
+

+ 2
- 2
tests/git-bin/out.side-by-side View File

16
 --- a/foo.html
16
 --- a/foo.html
17
 +++ b/foo.html
17
 +++ b/foo.html
18
 @@ -1,4 +1,4 @@
18
 @@ -1,4 +1,4 @@
19
-1 <!doctype html>                                                                  1 <!DOCTYPE html>
19
+1 <!doctype html>                                                                  1 <!DOCTYPE html>
20
 2 <html>                                                                           2 <html>
20
 2 <html>                                                                           2 <html>
21
 3                                                                                  3 
21
 3                                                                                  3 
22
 4 <head>                                                                           4 <head>
22
 4 <head>                                                                           4 <head>
23
 diff --git a/foo.pdf b/foo.pdf
23
 diff --git a/foo.pdf b/foo.pdf
24
 index 0e90017..3c3b90d 100644
24
 index 0e90017..3c3b90d 100644
25
 Binary files a/foo.pdf and b/foo.pdf differ
25
 Binary files a/foo.pdf and b/foo.pdf differ
26
-
26
+

+ 3
- 3
tests/git-bin/out.w70 View File

5
 @@ -13,3 +13,5 @@ INPUT=${1:-foo.html}
5
 @@ -13,3 +13,5 @@ INPUT=${1:-foo.html}
6
 13 OUTPUT=${INPUT%.html}.pdf                                              13 OUTPUT=${INPUT%.html}.pdf
6
 13 OUTPUT=${INPUT%.html}.pdf                                              13 OUTPUT=${INPUT%.html}.pdf
7
 14                                                                        14 
7
 14                                                                        14 
8
-15 wkhtmltopdf --page-size A4 $INPUT $OUTPUT  # very very long comments > 15 wkhtmltopdf --page-size A4 $INPUT $OUTPUT  # very very long comments >
8
+15 wkhtmltopdf --page-size A4 $INPUT $OUTPUT  # very very long comments > 15 wkhtmltopdf --page-size A4 $INPUT $OUTPUT  # very very long comments >
9
                                                                           16 
9
                                                                           16 
10
                                                                           17 # EOF
10
                                                                           17 # EOF
11
 diff --git a/example.pdf b/example.pdf
11
 diff --git a/example.pdf b/example.pdf
16
 --- a/foo.html
16
 --- a/foo.html
17
 +++ b/foo.html
17
 +++ b/foo.html
18
 @@ -1,4 +1,4 @@
18
 @@ -1,4 +1,4 @@
19
-1 <!doctype html>                                                        1 <!DOCTYPE html>
19
+1 <!doctype html>                                                        1 <!DOCTYPE html>
20
 2 <html>                                                                 2 <html>
20
 2 <html>                                                                 2 <html>
21
 3                                                                        3 
21
 3                                                                        3 
22
 4 <head>                                                                 4 <head>
22
 4 <head>                                                                 4 <head>
23
 diff --git a/foo.pdf b/foo.pdf
23
 diff --git a/foo.pdf b/foo.pdf
24
 index 0e90017..3c3b90d 100644
24
 index 0e90017..3c3b90d 100644
25
 Binary files a/foo.pdf and b/foo.pdf differ
25
 Binary files a/foo.pdf and b/foo.pdf differ
26
-
26
+

+ 1
- 1
tests/git-log/out.w70 View File

34
                                                                           17 
34
                                                                           17 
35
 17     """                                                                18     """
35
 17     """                                                                18     """
36
 18     # Set up option parser                                             19     # Set up option parser
36
 18     # Set up option parser                                             19     # Set up option parser
37
-19     parser = optparse.OptionParser(usage="modernize [options] file|di> 20     parser = optparse.OptionParser(usage="modernize [options] file|di>
37
+19     parser = optparse.OptionParser(usage="modernize [options] file|di> 20     parser = optparse.OptionParser(usage="modernize [options] file|di>

+ 2
- 2
tests/git/out.side-by-side View File

12
 128                     yield self._markup_common(' ' + old[1])                      128                     yield self._markup_common(' ' + old[1])
12
 128                     yield self._markup_common(' ' + old[1])                      128                     yield self._markup_common(' ' + old[1])
13
 129                                                                                  129 
13
 129                                                                                  129 
14
 130     def markup_side_by_side(self, width):                                        130     def markup_side_by_side(self, width):
14
 130     def markup_side_by_side(self, width):                                        130     def markup_side_by_side(self, width):
15
-131         """width of 0 means infinite width, None means auto detect. Returns a    131         """Returns a generator"""
15
+131         """width of 0 means infinite width, None means auto detect. Returns a    131         """Returns a generator"""
16
 132         generator     
16
 132         generator     
17
 133         """     
17
 133         """     
18
 134         def _normalize(line):                                                    132         def _normalize(line):
18
 134         def _normalize(line):                                                    132         def _normalize(line):
22
 147                 return markup                                                    145                 return markup
22
 147                 return markup                                                    145                 return markup
23
 148                                                                                  146 
23
 148                                                                                  146 
24
 149         # Setup line width and number width                                      147         # Setup line width and number width
24
 149         # Setup line width and number width                                      147         # Setup line width and number width
25
-150         if not width: width = 80                                                 148         if width <= 0:
25
+150         if not width: width = 80                                                 148         if width <= 0:
26
                                                                                      149             width = 80
26
                                                                                      149             width = 80
27
 151         (start, offset) = self._hunks[-1].get_old_addr()                         150         (start, offset) = self._hunks[-1].get_old_addr()
27
 151         (start, offset) = self._hunks[-1].get_old_addr()                         150         (start, offset) = self._hunks[-1].get_old_addr()
28
 152         max1 = start + offset - 1                                                151         max1 = start + offset - 1
28
 152         max1 = start + offset - 1                                                151         max1 = start + offset - 1

+ 2
- 2
tests/git/out.w70 View File

12
 128                     yield self._markup_common(' ' + old[1])            128                     yield self._markup_common(' ' + old[1])
12
 128                     yield self._markup_common(' ' + old[1])            128                     yield self._markup_common(' ' + old[1])
13
 129                                                                        129 
13
 129                                                                        129 
14
 130     def markup_side_by_side(self, width):                              130     def markup_side_by_side(self, width):
14
 130     def markup_side_by_side(self, width):                              130     def markup_side_by_side(self, width):
15
-131         """width of 0 means infinite width, None means auto detect. R> 131         """Returns a generator"""
15
+131         """width of 0 means infinite width, None means auto detect. R> 131         """Returns a generator"""
16
 132         generator     
16
 132         generator     
17
 133         """     
17
 133         """     
18
 134         def _normalize(line):                                          132         def _normalize(line):
18
 134         def _normalize(line):                                          132         def _normalize(line):
22
 147                 return markup                                          145                 return markup
22
 147                 return markup                                          145                 return markup
23
 148                                                                        146 
23
 148                                                                        146 
24
 149         # Setup line width and number width                            147         # Setup line width and number width
24
 149         # Setup line width and number width                            147         # Setup line width and number width
25
-150         if not width: width = 80                                       148         if width <= 0:
25
+150         if not width: width = 80                                       148         if width <= 0:
26
                                                                            149             width = 80
26
                                                                            149             width = 80
27
 151         (start, offset) = self._hunks[-1].get_old_addr()               150         (start, offset) = self._hunks[-1].get_old_addr()
27
 151         (start, offset) = self._hunks[-1].get_old_addr()               150         (start, offset) = self._hunks[-1].get_old_addr()
28
 152         max1 = start + offset - 1                                      151         max1 = start + offset - 1
28
 152         max1 = start + offset - 1                                      151         max1 = start + offset - 1

+ 3
- 1
tests/regression.sh View File

33
     local cdiff_opt=${3:-""}
33
     local cdiff_opt=${3:-""}
34
     local cmd
34
     local cmd
35
 
35
 
36
-    cmd=$(printf "%-8s $CDIFF %-18s <  %-30s " $PYTHON "$cdiff_opt" "$input")
36
+    cmd=$(printf "%-8s $CDIFF %-24s <  %-30s " $PYTHON "$cdiff_opt" "$input")
37
     printf "$cmd"
37
     printf "$cmd"
38
     if eval $cmd 2>/dev/null | diff -ubq $expected_out - >& /dev/null; then
38
     if eval $cmd 2>/dev/null | diff -ubq $expected_out - >& /dev/null; then
39
         pass
39
         pass
56
         cmp_output $d/in.diff $d/out.normal "-c always" || ((e++))
56
         cmp_output $d/in.diff $d/out.normal "-c always" || ((e++))
57
         cmp_output $d/in.diff $d/out.side-by-side "-c always -s" || ((e++))
57
         cmp_output $d/in.diff $d/out.side-by-side "-c always -s" || ((e++))
58
         cmp_output $d/in.diff $d/out.w70 "-c always -s -w70" || ((e++))
58
         cmp_output $d/in.diff $d/out.w70 "-c always -s -w70" || ((e++))
59
+        cmp_output $d/in.diff $d/out.w70.wrap "-c always -s -w70 --wrap" || ((e++))
59
         cmp_output $d/in.diff $d/in.diff "-c auto" || ((e++))
60
         cmp_output $d/in.diff $d/in.diff "-c auto" || ((e++))
60
         cmp_output $d/in.diff $d/in.diff "-c auto -s" || ((e++))
61
         cmp_output $d/in.diff $d/in.diff "-c auto -s" || ((e++))
61
         cmp_output $d/in.diff $d/in.diff "-c auto -s -w70" || ((e++))
62
         cmp_output $d/in.diff $d/in.diff "-c auto -s -w70" || ((e++))
63
+        cmp_output $d/in.diff $d/in.diff "-c auto -s -w70 --wrap" || ((e++))
62
         (( total += 6 ))
64
         (( total += 6 ))
63
     done
65
     done
64
 
66
 

+ 5
- 5
tests/svn/out.w70 View File

5
 @@ -3,7 +3,6 @@
5
 @@ -3,7 +3,6 @@
6
   3 ## About                                                                 3 ## About
6
   3 ## About                                                                 3 ## About
7
   4                                                                          4 
7
   4                                                                          4 
8
-  5 Coderev is a toolkit generates static side-by-side html pages for cod>   5 Coderev is a toolkit generates static side-by-side html pages for cod>
8
+  5 Coderev is a toolkit generates static side-by-side html pages for cod>   5 Coderev is a toolkit generates static side-by-side html pages for cod>
9
   6 Typical use case is to generate diff pages for local modification in >     
9
   6 Typical use case is to generate diff pages for local modification in >     
10
   7 workspace and send page link to teammates for code review.               6 workspace and send page link to teammates for code review.
10
   7 workspace and send page link to teammates for code review.               6 workspace and send page link to teammates for code review.
11
   8                                                                          7 
11
   8                                                                          7 
12
-  9 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>   8 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>
12
+  9 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>   8 See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) f>
13
 @@ -18,9 +17,10 @@
13
 @@ -18,9 +17,10 @@
14
  18                                                                         17 
14
  18                                                                         17 
15
  19 ## Usage of coderev.sh                                                  18 ## Usage of coderev.sh
15
  19 ## Usage of coderev.sh                                                  18 ## Usage of coderev.sh
18
  22                                                                         21 
18
  22                                                                         21 
19
  23     Usage:                                                              22     Usage:
19
  23     Usage:                                                              22     Usage:
20
                                                                             23 
20
                                                                             23 
21
- 24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>  24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>
21
+ 24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>  24         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name>
22
  25                 [-F comment-file | -m 'comment...'] [file...]           25                 [-F comment-file | -m 'comment...'] [file...]
22
  25                 [-F comment-file | -m 'comment...'] [file...]           25                 [-F comment-file | -m 'comment...'] [file...]
23
  26                                                                         26 
23
  26                                                                         26 
24
 @@ -145,3 +145,5 @@
24
 @@ -145,3 +145,5 @@
25
-145                             specify column number where lines are bro> 145                             specify column number where lines are bro>
26
-146                             wrapped for sdiff, default is no line wra> 146                             wrapped for sdiff, default is no line wra>
25
+145                             specify column number where lines are bro> 145                             specify column number where lines are bro>
26
+146                             wrapped for sdiff, default is no line wra> 146                             wrapped for sdiff, default is no line wra>
27
 147     -y, --yes             do not prompt for overwriting                147     -y, --yes             do not prompt for overwriting
27
 147     -y, --yes             do not prompt for overwriting                147     -y, --yes             do not prompt for overwriting
28
                                                                            148 
28
                                                                            148 
29
                                                                            149 # EOF
29
                                                                            149 # EOF

+ 6
- 7
tests/test_cdiff.py View File

231
             '\x1b[33m1\x1b[0m '
231
             '\x1b[33m1\x1b[0m '
232
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m  '
232
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m  '
233
             '\x1b[0m\x1b[33m1\x1b[0m '
233
             '\x1b[0m\x1b[33m1\x1b[0m '
234
-            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\x1b[32m\x1b[0m\n')
234
+            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\n')
235
         self.assertEqual(
235
         self.assertEqual(
236
             out[6],
236
             out[6],
237
             '\x1b[33m '
237
             '\x1b[33m '
261
             '\x1b[33m5\x1b[0m '
261
             '\x1b[33m5\x1b[0m '
262
             '\x1b[31m\x1b[7m\x1b[31m      \x1b[0m\x1b[1;35m>\x1b[0m '
262
             '\x1b[31m\x1b[7m\x1b[31m      \x1b[0m\x1b[1;35m>\x1b[0m '
263
             '\x1b[0m\x1b[33m5\x1b[0m '
263
             '\x1b[0m\x1b[33m5\x1b[0m '
264
-            '\x1b[32m\x1b[7m\x1b[32m spaced\x1b[0m\x1b[32m\x1b[0m\n')
264
+            '\x1b[32m\x1b[7m\x1b[32m spaced\x1b[0m\n')
265
 
265
 
266
     # This test is not valid anymore
266
     # This test is not valid anymore
267
     def __test_markup_side_by_side_neg_width(self):
267
     def __test_markup_side_by_side_neg_width(self):
325
         self.assertEqual(out[4], '\x1b[1;34m@@ -1,5 +1,5 @@\n\x1b[0m')
325
         self.assertEqual(out[4], '\x1b[1;34m@@ -1,5 +1,5 @@\n\x1b[0m')
326
         self.assertEqual(
326
         self.assertEqual(
327
             out[5],
327
             out[5],
328
-
329
             '\x1b[33m1\x1b[0m '
328
             '\x1b[33m1\x1b[0m '
330
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m '
329
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m '
331
             '\x1b[0m\x1b[33m1\x1b[0m '
330
             '\x1b[0m\x1b[33m1\x1b[0m '
332
-            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\x1b[32m\x1b[0m\n')
331
+            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\n')
333
         self.assertEqual(
332
         self.assertEqual(
334
             out[6],
333
             out[6],
335
             '\x1b[33m \x1b[0m        '
334
             '\x1b[33m \x1b[0m        '
432
             '\x1b[33m1\x1b[0m '
431
             '\x1b[33m1\x1b[0m '
433
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m   '
432
             '\x1b[31m\x1b[7m\x1b[31mh\x1b[0m\x1b[31mhello\x1b[0m   '
434
             '\x1b[0m\x1b[33m1\x1b[0m '
433
             '\x1b[0m\x1b[33m1\x1b[0m '
435
-            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\x1b[32m\x1b[0m\n')
434
+            '\x1b[32mhello\x1b[7m\x1b[32mo\x1b[0m\n')
436
         self.assertEqual(
435
         self.assertEqual(
437
             out[6],
436
             out[6],
438
             '\x1b[33m '
437
             '\x1b[33m '
460
         self.assertEqual(
459
         self.assertEqual(
461
             out[10],
460
             out[10],
462
             '\x1b[33m5\x1b[0m '
461
             '\x1b[33m5\x1b[0m '
463
-            '\x1b[31m\x1b[7m\x1b[31m  tabbed\x1b[0m\x1b[31m\x1b[0m '
462
+            '\x1b[31m\x1b[7m\x1b[31m  tabbed\x1b[0m '
464
             '\x1b[0m\x1b[33m5\x1b[0m '
463
             '\x1b[0m\x1b[33m5\x1b[0m '
465
-            '\x1b[32m\x1b[7m\x1b[32m spaced\x1b[0m\x1b[32m\x1b[0m\n')
464
+            '\x1b[32m\x1b[7m\x1b[32m spaced\x1b[0m\n')
466
 
465
 
467
 
466
 
468
 class UnifiedDiffTest(unittest.TestCase):
467
 class UnifiedDiffTest(unittest.TestCase):