Browse Source

Better error handling

Marcelo Fornet 4 năm trước cách đây
mục cha
commit
517df7e028
2 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 4 1
      main.py
  2. 1 1
      tests.py

+ 4 - 1
main.py

@@ -1,3 +1,4 @@
+#!/usr/bin/python3
 import argparse
 from os.path import join, exists, isfile, basename
 from os import makedirs, listdir
@@ -71,7 +72,9 @@ def main():
             print("No parts found")
             exit(2)
 
-        makedirs(args.output, exist_ok=True)
+        if args.output != '':
+            makedirs(args.output, exist_ok=True)
+
         output = join(args.output, expected_name)
 
         if exists(output):

+ 1 - 1
tests.py

@@ -30,7 +30,7 @@ class TestShamir(unittest.TestCase):
 
     def test_full_encode_decode(self):
         K = [2, 2, 2, 3, 3, 4, 1, 2, 3, 4, 5, 6, 7]
-        N = [2, 3, 4, 4, 5, 6, 7, 7, 7, 4, 5, 6, 7]
+        N = [2, 3, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7]
 
         for it in range(10):
             for k, n in zip(K, N):