Пример #1
0
    def encapsulate_call(self, function, dh, **kwargs):
        out = function(dh, **kwargs)

        if isinstance(out, DataHolder):
            dh = out
        elif isinstance(out, tuple):
            dh = out[0]
            # Read the true solution
        sol = DataHolder.from_pickle_file(self.sol_path + dh.name + "_" +
                                          str(self.counter) + ".pickle")
        dh = dh.merge_in_original_sheets(save_sheet_names=True)
        if not dh.equals(sol):
            print(function)
            dh.write_excel(self.out_path + "candidate.xls")
            sol.write_excel(self.out_path + "solution.xls")
            self.assertTrue(dh.equals(sol))
        self.counter += 1
        return out
Пример #2
0
from python_back_end.utilities.state_handling import DataHolder
from python_back_end.program_settings import PROGRAM_DIRECTORIES as pdir
import numpy as np

dh1 = DataHolder.from_pickle_file(pdir.TEMP_DIR + "from_views.pickle")
dh2 = DataHolder.from_pickle_file(pdir.TEMP_DIR + "from_backend.pickle")

for ds1, ds2 in zip(dh1, dh2):
    bools = ds1.df_data == ds2.df_data
    self_bool1 = ds1.df_data == ds1.df_data
    self_bool2 = ds2.df_data == ds2.df_data
    complement = bools == self_bool2
    p_bools = ds1.df_profiles == ds2.df_profiles

    if not np.all(bools):
        print(np.all(complement))
        print(np.all(p_bools))