tests: replace pycodestyle with black
[vpp.git] / src / plugins / nat / pnat / tests / test_genpackets.py
index 9d32d3e..4086731 100755 (executable)
@@ -6,33 +6,35 @@ from importlib.machinery import SourceFileLoader
 from scapy.all import *
 from scapy.contrib.geneve import GENEVE
 
+
 def hexstring(p):
     s = bytes(p.__class__(p))
     return ",".join("0x{:02x}".format(c) for c in s)
 
+
 def output_test(filename, tests):
     (name, ext) = os.path.basename(filename).split(".")
-    print('/* DO NOT EDIT: automatically generated by test_genpackets.py */')
-    print('/* clang-format off */')
-    print('test_t tests_{}[] = {{'.format(name))
+    print("/* DO NOT EDIT: automatically generated by test_genpackets.py */")
+    print("/* clang-format off */")
+    print("test_t tests_{}[] = {{".format(name))
 
     for t in tests:
-        print('  {')
+        print("  {")
         print('    .name = "{}",'.format(t[0]))
-        print('    .nsend = {},'.format(len(t[1])))
-        print('    .send = (char []){{{}}},'.format(hexstring(t[1])))
-        print('    .nexpect = {},'.format(len(t[2])))
-        print('    .expect = (char []){{{}}},'.format(hexstring(t[2])))
-        print('    .expect_next_index = {}'.format(t[3]))
-        print('  },')
-    print('};')
-    print('/* clang-format on */')
+        print("    .nsend = {},".format(len(t[1])))
+        print("    .send = (char []){{{}}},".format(hexstring(t[1])))
+        print("    .nexpect = {},".format(len(t[2])))
+        print("    .expect = (char []){{{}}},".format(hexstring(t[2])))
+        print("    .expect_next_index = {}".format(t[3]))
+        print("  },")
+    print("};")
+    print("/* clang-format on */")
+
 
 # Read tests from file
 for filename in sys.argv[1:]:
     with open(filename) as f:
-        content = f.read().replace('\n', '')
+        content = f.read().replace("\n", "")
 
     tests = eval(content)
     output_test(filename, tests)
-