<commit_before>#-*- coding: utf-8 -*-
"""
@brief      test log(time=1s)
"""

import sys
import os
import unittest
import re

try:
    import src
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..")))
    if path not in sys.path:
        sys.path.append(path)
    import src

try:
    import pyquickhelper
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..",
                "..",
                "pyquickhelper",
                "src")))
    if path not in sys.path:
        sys.path.append(path)
    import pyquickhelper

from pyquickhelper import fLOG, get_temp_folder
from src.actuariat_python.data import population_france_2015
from src.actuariat_python.plots import plot_population_pyramid

from matplotlib import pyplot as plt


class TestPopulationPlots(unittest.TestCase):

    def test_population_france2015_plots(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        df = population_france_2015()
        print(df.columns)
        ax = plot_population_pyramid(df["hommes"], df["femmes"])
        assert ax is not None
        # avoid matplotlib to crash later
        plt.close('all')
<commit_msg>fix a unit test for travis<commit_after>#-*- coding: utf-8 -*-
"""
@brief      test log(time=1s)
"""

import sys
import os
import unittest
import re

try:
    import src
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..")))
    if path not in sys.path:
        sys.path.append(path)
    import src

try:
    import pyquickhelper
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..",
                "..",
                "pyquickhelper",
                "src")))
    if path not in sys.path:
        sys.path.append(path)
    import pyquickhelper

from pyquickhelper import fLOG, get_temp_folder
from pyquickhelper.pycode import fix_tkinter_issues_virtualenv
from src.actuariat_python.data import population_france_2015
from src.actuariat_python.plots import plot_population_pyramid
from matplotlib import pyplot as plt


class TestPopulationPlots(unittest.TestCase):

    def test_population_france2015_plots(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
            
        fix_tkinter_issues_virtualenv()
            
        df = population_france_2015()
        ax = plot_population_pyramid(df["hommes"], df["femmes"])
        assert ax is not None
        # avoid matplotlib to crash later
        plt.close('all')

{'fraction_non_alphanumeric': 0.10109018830525272, 'fraction_numerical': 0.010571522960026428, 'mean_word_length': 1.9426627793974733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '811', 'n_tokens_mistral': 962, 'n_tokens_neox': 901, 'n_words': 203}