contrib/bdiff-torture.py
changeset 43076 2372284d9457
parent 43009 e05c141511dd
child 48875 6000f5b25c9b
--- a/contrib/bdiff-torture.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/contrib/bdiff-torture.py	Sun Oct 06 09:45:02 2019 -0400
@@ -9,15 +9,20 @@
     pycompat,
 )
 
+
 def reducetest(a, b):
     tries = 0
     reductions = 0
     print("reducing...")
     while tries < 1000:
-        a2 = "\n".join(l for l in a.splitlines()
-                       if random.randint(0, 100) > 0) + "\n"
-        b2 = "\n".join(l for l in b.splitlines()
-                       if random.randint(0, 100) > 0) + "\n"
+        a2 = (
+            "\n".join(l for l in a.splitlines() if random.randint(0, 100) > 0)
+            + "\n"
+        )
+        b2 = (
+            "\n".join(l for l in b.splitlines() if random.randint(0, 100) > 0)
+            + "\n"
+        )
         if a2 == a and b2 == b:
             continue
         if a2 == b2:
@@ -32,8 +37,7 @@
             a = a2
             b = b2
 
-    print("reduced:", reductions, len(a) + len(b),
-          repr(a), repr(b))
+    print("reduced:", reductions, len(a) + len(b), repr(a), repr(b))
     try:
         test1(a, b)
     except Exception as inst:
@@ -41,6 +45,7 @@
 
     sys.exit(0)
 
+
 def test1(a, b):
     d = mdiff.textdiff(a, b)
     if not d:
@@ -49,6 +54,7 @@
     if c != b:
         raise ValueError("bad")
 
+
 def testwrap(a, b):
     try:
         test1(a, b)
@@ -57,10 +63,12 @@
         print("exception:", inst)
     reducetest(a, b)
 
+
 def test(a, b):
     testwrap(a, b)
     testwrap(b, a)
 
+
 def rndtest(size, noise):
     a = []
     src = "                aaaaaaaabbbbccd"
@@ -82,6 +90,7 @@
 
     test(a, b)
 
+
 maxvol = 10000
 startsize = 2
 while True: