final

parent 08eae066
...@@ -11,6 +11,11 @@ def load_params(file="params.ini"): ...@@ -11,6 +11,11 @@ def load_params(file="params.ini"):
которым по умолчанию является params.ini ''' которым по умолчанию является params.ini '''
global PARAMS global PARAMS
try:
open(file, 'r', errors='ignore')
except FileNotFoundError:
print("Такого файла с параметрами не существует")
else:
with open(file, 'r', errors='ignore') as f: with open(file, 'r', errors='ignore') as f:
lines = f.readlines() lines = f.readlines()
for l in lines: for l in lines:
...@@ -132,6 +137,7 @@ class TestCalculator(unittest.TestCase): ...@@ -132,6 +137,7 @@ class TestCalculator(unittest.TestCase):
def test_precision(self): def test_precision(self):
self.assertEqual(convert_precision(0.0000001), 7) self.assertEqual(convert_precision(0.0000001), 7)
self.assertEqual(convert_precision(0.001), 3)
def test_error(self): def test_error(self):
with self.assertRaises(Exception): with self.assertRaises(Exception):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment