Esempio n. 1
0
 def test_required_false(self):
     print("\nTesting ReadConfig required values for non-existence")
     current_dir = os.getcwd()
     init_dir = "ReadConfig_Test_data"
     file_name = "check_required_invalid.json"
     full_path = os.path.join(current_dir, init_dir)
     ready_file_name = ReadConfig(full_path, file_name)
     ready_file_name.init_data_read()
     init_read_status = ready_file_name.get_init_read_errors()
     self.assertEqual(init_read_status & 0b1, 0b1)
Esempio n. 2
0
 def test_read_variable_None(self):
     print("\nTesting ReadConfig with variable missing")
     current_dir = os.getcwd()
     init_dir = "ReadConfig_Test_data"
     file_name = "check_matrix_read_sympy_valid.json"
     full_path = os.path.join(current_dir, init_dir)
     ready_file_name = ReadConfig(full_path, file_name)
     ready_file_name.init_data_read()
     A = ready_file_name.get_variable("A")
     self.assertIsNone(A)
Esempio n. 3
0
 def test_read_matrix_sympy(self):
     print("\nTesting ReadConfig with matrix data - sympy")
     current_dir = os.getcwd()
     init_dir = "ReadConfig_Test_data"
     file_name = "check_matrix_read_sympy_valid.json"
     full_path = os.path.join(current_dir, init_dir)
     ready_file_name = ReadConfig(full_path, file_name)
     ready_file_name.init_data_read()
     A = ready_file_name.get_matrix("A")
     self.assertTrue(A.equals(smp.Matrix([[1, 2, 3], [4, 5, 6]])))
Esempio n. 4
0
 def test_read_variables(self):
     print("\nTesting ReadConfig with variable missing")
     current_dir = os.getcwd()
     init_dir = "ReadConfig_Test_data"
     file_name = "check_matrix_read_sympy_valid.json"
     full_path = os.path.join(current_dir, init_dir)
     ready_file_name = ReadConfig(full_path, file_name)
     ready_file_name.init_data_read()
     b = ready_file_name.get_variable("B")
     self.assertEqual(int(b), 2)
     c = ready_file_name.get_variable("C")
     self.assertEqual(float(c), float(3.14159))