From 7d22135b4c3f8fb70552302bf8239df9976dddda Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 8 May 2012 19:38:49 +0200 Subject: [PATCH] Make hb-diff faster --- test/shaping/hb_test_tools.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 94207f8db..d85c38e03 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -1,6 +1,7 @@ #!/usr/bin/python import sys, os, re, difflib, unicodedata, errno +from itertools import * class Colors: class Null: @@ -91,7 +92,7 @@ class FancyDiffer: @staticmethod def diff_files (f1, f2, colors=Colors.Null): try: - for (l1,l2) in zip (f1, f2): + for (l1,l2) in izip (f1, f2): if l1 == l2: sys.stdout.writelines ([" ", l1]) continue @@ -100,7 +101,7 @@ class FancyDiffer: # print out residues for l in f1: sys.stdout.writelines (["-", colors.red, l, colors.end]) - for l in f1: + for l in f2: sys.stdout.writelines (["-", colors.green, l, colors.end]) except IOError as e: if e.errno != errno.EPIPE: @@ -114,6 +115,7 @@ class DiffFilters: def filter_failures (f): for l in f: if l[0] in '-+': + # TODO retain all lines of the failure yield l