Example #1
0
    def test_canonical_file_not_found(self):
        from pysd.tools.benchmarking import runner

        with self.assertRaises(FileNotFoundError) as err:
            runner(os.path.join(_root, "more-tests/not_existent.mdl"))

        self.assertIn('Canonical output file not found.', str(err.exception))
Example #2
0
    def test_non_valid_model(self):
        from pysd.tools.benchmarking import runner

        with self.assertRaises(ValueError) as err:
            runner(
                os.path.join(_root,
                             "more-tests/not_vensim/test_not_vensim.txt"))

        self.assertIn('Modelfile should be *.mdl or *.xmile',
                      str(err.exception))
 def test_subscript_mapping_vensim(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         output, canon = runner(
             test_models +
             '/subscript_mapping_vensim/test_subscript_mapping_vensim.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_repeated_subscript(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         output, canon = runner(
             test_models +
             '/repeated_subscript/test_repeated_subscript.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_get_lookups_subscripted_args(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         output, canon = runner(test_models +
                                '/get_lookups_subscripted_args/' +
                                'test_get_lookups_subscripted_args.mdl')
     assert_frames_close(output, canon, rtol=rtol)
    def test_get_with_missing_values_xlsx(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            output, canon = runner(test_models +
                                   '/get_with_missing_values_xlsx/' +
                                   'test_get_with_missing_values_xlsx.mdl')

        assert_frames_close(output, canon, rtol=rtol)
 def test_get_subscript_3d_arrays_xls(self):
     """
     Test for usage of GET DIRECT/XLS SUBSCRIPTS/CONSTANTS from a Excel file
     All the possible combinations of lentgh-wise and different dimensions
     are tested in unit_test_external.py, this test want to test only the
     good working of the builder
     """
     output, canon = runner(test_models + '/get_subscript_3d_arrays_xls/' +
                            'test_get_subscript_3d_arrays_xls.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_get_lookups_data_3d_xls(self):
     """
     Test for usage of GET DIRECT/XLS LOOKUPS/DATA from a Excel file
     All the possible combinations of lentgh-wise and different dimensions
     are tested in unit_test_external.py, this test want to test only the
     good working of the builder
     """
     output, canon = runner(test_models + '/get_lookups_data_3d_xls/' +
                            'test_get_lookups_data_3d_xls.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscripted_logicals(self):
     output, canon = runner(
         test_models +
         '/subscripted_logicals/test_subscripted_logicals.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_constant_expressions(self):
     output, canon = runner(
         test_models +
         '/constant_expressions/test_constant_expressions.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_run_uppercase(self):
     output, canon = runner(test_models +
                            '/case_sensitive_extension/teacup-upper.MDL')
     assert_frames_close(output, canon, rtol=rtol)
 def test_unicode_characters(self):
     output, canon = runner(test_models +
                            '/unicode_characters/unicode_test_model.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_trig(self):
     output, canon = runner(test_models + '/trig/test_trig.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscripted_xidz(self):
     output, canon = runner(test_models +
                            '/subscripted_xidz/test_subscripted_xidz.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscripted_trend(self):
     # issue https://github.com/JamesPHoughton/pysd/issues/226
     output, canon = runner(test_models +
                            '/subscripted_trend/test_subscripted_trend.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_control_vars(self):
     output, canon = runner(test_models +
                            '/control_vars/test_control_vars.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscript_numeric_range(self):
     output, canon = runner(
         test_models +
         '/subscript_numeric_range/test_subscript_numeric_range.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subset_duplicated_coord(self):
     output, canon = runner(test_models + '/subset_duplicated_coord/' +
                            'test_subset_duplicated_coord.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_conditional_subscripts(self):
     output, canon = runner(
         test_models +
         '/conditional_subscripts/test_conditional_subscripts.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_variable_ranges(self):
     output, canon = runner(test_models +
                            '/variable_ranges/test_variable_ranges.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscript_subranges_equal(self):
     output, canon = runner(
         test_models +
         '/subscript_subranges_equal/test_subscript_subrange_equal.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_xidz_zidz(self):
     output, canon = runner(test_models + '/xidz_zidz/xidz_zidz.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscript_transposition(self):
     output, canon = runner(
         test_models +
         '/subscript_transposition/test_subscript_transposition.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_odd_number_quotes(self):
     output, canon = runner(test_models +
                            '/odd_number_quotes/teacup_3quotes.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscript_updimensioning(self):
     output, canon = runner(
         test_models +
         '/subscript_updimensioning/test_subscript_updimensioning.mdl')
     assert_frames_close(output, canon, rtol=rtol)
 def test_data_from_other_model(self):
     output, canon = runner(
         test_models +
         '/data_from_other_model/test_data_from_other_model.mdl',
         data_files=test_models + '/data_from_other_model/data.tab')
     assert_frames_close(output, canon, rtol=rtol)
 def test_subscripted_if_then_else(self):
     output, canon = runner(
         test_models +
         '/subscripted_if_then_else/test_subscripted_if_then_else.mdl')
     assert_frames_close(output, canon, rtol=rtol)