def test_long_long_notebook_population(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        fix_tkinter_issues_virtualenv()
        from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook

        if "travis" in sys.executable:
            # matplotlib is still failing
            warnings.warn(
                "travis, unable to test TestNotebookPopulation.test_notebook_sessions"
            )
            return

        temp = get_temp_folder(__file__, "temp_sessions_long_long")
        keepnote = [
            _ for _ in ls_notebooks("sessions") if
            "seance6_graphes_correction" in _ or "seance6_graphes_enonce" in _
        ]
        self.assertTrue(len(keepnote) > 0)
        clog = CustomLog(temp)
        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: "deviner" not in n,
                                fLOG=fLOG,
                                clean_function=clean_function_notebook,
                                detailed_log=clog)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=fLOG,
                                          dump=actuariat_python)
    def test_notebook_internet(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        fix_tkinter_issues_virtualenv()

        if "travis" in sys.executable:
            # matplotlib is still failing
            warnings.warn(
                "travis, unable to test TestNotebookInternet.test_notebook_internet"
            )
            return

        from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
        from mlstatpy.data.wikipedia import download_pageviews
        self.assertTrue(download_pageviews)
        temp = get_temp_folder(__file__, "temp_internet")
        keepnote = [
            _ for _ in ls_notebooks("internet")
            if "wikipedia_stats_correction" not in _
        ]
        self.assertTrue(len(keepnote) > 0)
        for k in keepnote:
            fLOG(k)
        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: True,
                                fLOG=fLOG,
                                clean_function=clean_function_notebook)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=fLOG,
                                          dump=actuariat_python)
Example #3
0
    def test_notebook_decouverte(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks
        from actuariat_python.automation.notebook_test_helper import clean_function_notebook
        temp = get_temp_folder(__file__, "temp_decouverte")
        keepnote = [_ for _ in ls_notebooks("decouverte")]
        self.assertTrue(len(keepnote) > 0)

        # copy data
        folder = os.path.dirname(keepnote[0])
        data = [os.path.join(folder, "UN_Data.csv")]
        for dt in data:
            shutil.copy(dt, temp)

        # run the notebooks
        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: True,
                                fLOG=fLOG,
                                clean_function=clean_function_notebook)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=fLOG,
                                          dump=actuariat_python)
    def a_test_notebook_session(self, name):
        from actuariat_python.automation.notebook_test_helper import (
            ls_notebooks, execute_notebooks, clean_function_notebook)
        temp = get_temp_folder(__file__, "temp_sessions_" + name.split('.')[0])
        keepnote = [
            _ for _ in ls_notebooks("sessions")
            if "seance5_approche_fonctionnelle_enonce" not in _
            and "seance6_graphes_ml_enonce" not in _
            and "election_carte_electorale_correction" not in _
            and "seance6_graphes_correction" not in _
            and "seance6_graphes_enonce" not in _ and "ways" not in _
        ]
        if is_travis_or_appveyor():
            keepnote = [
                _ for _ in keepnote if "election_carte_electorale" not in _
            ]
        if name is not None:
            keepnote = list(filter(lambda n: name in n, keepnote))
        if len(keepnote) == 0:
            return
        for k in keepnote:
            fLOG(k)

        # copy data
        fold = os.path.dirname(keepnote[0])
        files = [os.path.join(fold, "pop-totale-france.txt")]
        for name_ in files:
            shutil.copy(name_, temp)
        data_tem = os.path.join(temp, "data")
        if not os.path.exists(data_tem):
            os.mkdir(data_tem)
        files = [
            os.path.join(fold, "data", "housing.data"),
            os.path.join(fold, "data", "housing.names"),
            os.path.join(fold, "data", "multiTimeline.csv"),
        ]
        for name_ in files:
            shutil.copy(name_, data_tem)

        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: "deviner" not in n,
                                fLOG=fLOG,
                                clean_function=clean_function_notebook)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=fLOG,
                                          dump=actuariat_python)
Example #5
0
 def test_notebook_examen(self):
     fLOG(__file__,
          self._testMethodName,
          OutputPrint=__name__ == "__main__")
     fix_tkinter_issues_virtualenv()
     from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
     temp = get_temp_folder(__file__, "temp_examen")
     keepnote = ls_notebooks("examen")
     self.assertTrue(len(keepnote) > 0)
     res = execute_notebooks(temp,
                             keepnote,
                             lambda i, n: "deviner" not in n,
                             fLOG=fLOG,
                             clean_function=clean_function_notebook)
     execute_notebook_list_finalize_ut(res,
                                       fLOG=fLOG,
                                       dump=actuariat_python)
    def test_notebook_population(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        fix_tkinter_issues_virtualenv()

        from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
        temp = get_temp_folder(__file__, "temp_sessions_population")
        keepnote = [
            _ for _ in ls_notebooks("sessions")
            if "seance6_graphes_ml_enonce" in _
        ]
        self.assertTrue(len(keepnote) > 0)
        for k in keepnote:
            fLOG(k)
        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: "deviner" not in n,
                                fLOG=fLOG,
                                clean_function=clean_function_notebook)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=fLOG,
                                          dump=actuariat_python)
Example #7
0
    def test_notebook_population_gerry_mandering(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        fix_tkinter_issues_virtualenv()

        from actuariat_python.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
        temp = get_temp_folder(__file__, "temp_gerry_mandering")
        clog = CustomLog(temp)
        keepnote = [
            _ for _ in ls_notebooks("sessions")
            if "election_carte_electorale_correction" in _
        ]
        self.assertTrue(len(keepnote) > 0)
        res = execute_notebooks(temp,
                                keepnote,
                                lambda i, n: "deviner" not in n,
                                fLOG=clog,
                                deepfLOG=clog,
                                detailed_log=clog,
                                clean_function=clean_function_notebook)
        execute_notebook_list_finalize_ut(res,
                                          fLOG=clog,
                                          dump=actuariat_python)