Esempio n. 1
0
 def test_ok(self):
     """basic successful argument test"""
     parsed_params = auc.parse_commandline_arguments([
         "-p", "{3:2}", "-s", ".2", "-a", "simpson", "-l", "-2", "-u", "1.5"
     ])
     assert parsed_params.bounds.step_size == .2
     assert parsed_params.bounds.lower_bound == -2
     assert parsed_params.bounds.upper_bound == 1.5
     assert parsed_params.polynomial.coefficient_dict[3] == 2
     assert parsed_params.algorithm.__name__ == "simpson"
Esempio n. 2
0
 def test_help(self):
     """test help string"""
     try:
         auc.parse_commandline_arguments(["-h"])
     except SystemExit:
         return
Esempio n. 3
0
 def test_invalid_number(self):
     """reject invalid numerical argument"""
     parsed_params = auc.parse_commandline_arguments(["-l", "x3"])
     assert parsed_params is None
Esempio n. 4
0
 def test_invalid_option(self):
     """reject invalid option"""
     parsed_params = auc.parse_commandline_arguments(["-z", "3"])
     assert parsed_params is None
Esempio n. 5
0
 def test_invalid_polynomial_numeric_v(self):
     """reject invalid polynomial string"""
     parsed_params = auc.parse_commandline_arguments(["-p", "{a}"])
     assert parsed_params is None
Esempio n. 6
0
 def test_invalid_polynomial_set(self):
     """reject invalid polynomial string"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{3-1}", "-s", ".2", "-a", "simpson"])
     assert parsed_params is None
Esempio n. 7
0
 def test_invalid_bounds(self):
     """reject lower bound > upper bound"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{1.5:2}", "-l", "1", "-u", "0"])
     assert parsed_params is None
Esempio n. 8
0
 def test_invalid_step(self):
     """reject step size <=0"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{1.5:2}", "-s", "-1"])
     assert parsed_params is None
Esempio n. 9
0
 def test_fractional_exponent_negative_value(self):
     """reject fractional exponents with negative bounds"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{1.5:2}", "-s", ".2", "-l", "-5", "-a", "simpson"])
     assert parsed_params is None
Esempio n. 10
0
 def test_negative_exponent(self):
     """reject negative exponents"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{-3:2}", "-s", ".2", "-a", "simpson"])
     assert parsed_params is None
Esempio n. 11
0
 def test_invalid_algorithm(self):
     """reject incorrect algorithm name"""
     parsed_params = auc.parse_commandline_arguments(
         ["-p", "{3:2}", "-s", ".2", "-a", "simpsonx"])
     assert parsed_params is None