Example #1
0
 def test_parser_raises_error_if_missing_args(self):
     parser = get_parser()
     self.failUnlessRaises(
         SystemExit,
         parser.parse_args,
         '--csp-file {0} -c b -k -t r'.format(
             sample_csp_file_solvable
         ).split()
     )
Example #2
0
    def test_parser_works_if_input_ok(self):
        parser = get_parser()

        parsed_args = parser.parse_args(
            '--csp-file {0} -k -t r '
            '--sugar-jar sugar-v1-15-0.jar'.format(
                sample_csp_file_solvable
            ).split()
        )

        expected_result = argparse.Namespace(
            csp_file=[
                sample_csp_file_solvable
            ],
            keep_tmpfiles=True,
            minisat=None,
            sugar_jar='sugar-v1-15-0.jar',
            tmp_folder='r',
        )
        assert parsed_args == expected_result, parsed_args