# Path: lib/vis.py
# def plot_data (data, output_directory, output_file_name):
# def generate_probability_distribution(data):
# def exponential_curve_fit_and_plot(data, output_directory, output_file_name):
# def exponential_curve_fit_and_plot_x_shifted(data, output_directory, output_file_name):
# def plot_infomap_igraph(i_graph, membership, output_directory, output_file_name, show_edges=True, aux_data=None):
# def generate_log_plots(plot_data, output_directory, output_file_name):
# def calc_plot_linear_fit(x_in, y_in, output_directory, output_file_name):
#             def trace_helper_pyplot(x, y, label, color):
# def generate_group_bar_charts(y_values, x_values, trace_header, output_directory, output_file_name):
# def csv_heatmap_generator_plotly(in_directory, output_directory, output_file_name):
# def matplotlob_csv_heatmap_generator(csv_file, output_directory, output_file_name):
#     def np_arrange_helper(data, disp):
# def box_plot(data, output_directory, output_file_name):
# 
# Path: lib/util.py
# def correctLastCharCR(inText):#
# def correct_nick_for_(inText):
# def to_graph(l):
# def to_edges(l):
# def exponential_curve_func(x, a, b, c):
# def get_year_month_day(day_content):
# def rec_list_splice(rec_list):
# def check_if_msg_line (line):
# def build_graphs(nick_sender, nick_receiver, time, year, month, day, day_graph, aggr_graph):
# def HACK_convert_nx_igraph(nx_graph):
# def extend_conversation_list(nick_sender, nick_receiver, conversation):
# def create_connected_nick_list(conn_comp_list):
# def correct_last_char_list(rec_list):
# def splice_find(line, search_param1, search_param2, splice_index):
# def get_nick_sen_rec(iter_range, nick_to_search, conn_comp_list, nick_sen_rec):
# def get_nick_representative(nicks, nick_same_list, nick_to_compare):
# def find_top_n_element_after_sorting(in_list, index, reverseBool, n):
# def count_number_of_users_on_channel(nick_same_list):
# def save_to_disk(data,file_name):
# def load_from_disk(file_name):
#     G = nx.Graph()


import unittest
import os
import numpy as np
from lib import vis,util
from mock import patch


class VisTest(unittest.TestCase):
    def setUp(self):
        current_dir = os.path.dirname(os.path.abspath(__file__))
        self.test_data_dir = current_dir + "/../../data/test_lib/"

    def tearDown(self):
        self.test_data_dir = None

    def test_exponential_curve_fit_and_plot(self):
        data = util.load_from_disk(self.test_data_dir + "/vis/conv_len")
        expected_result = util.load_from_disk(self.test_data_dir + "/vis/conv_len_fit")

# Path: lib/vis.py
# def plot_data (data, output_directory, output_file_name):
# def generate_probability_distribution(data):
# def exponential_curve_fit_and_plot(data, output_directory, output_file_name):
# def exponential_curve_fit_and_plot_x_shifted(data, output_directory, output_file_name):
# def plot_infomap_igraph(i_graph, membership, output_directory, output_file_name, show_edges=True, aux_data=None):
# def generate_log_plots(plot_data, output_directory, output_file_name):
# def calc_plot_linear_fit(x_in, y_in, output_directory, output_file_name):
#             def trace_helper_pyplot(x, y, label, color):
# def generate_group_bar_charts(y_values, x_values, trace_header, output_directory, output_file_name):
# def csv_heatmap_generator_plotly(in_directory, output_directory, output_file_name):
# def matplotlob_csv_heatmap_generator(csv_file, output_directory, output_file_name):
#     def np_arrange_helper(data, disp):
# def box_plot(data, output_directory, output_file_name):
# 
# Path: lib/util.py
# def correctLastCharCR(inText):#
# def correct_nick_for_(inText):
# def to_graph(l):
# def to_edges(l):
# def exponential_curve_func(x, a, b, c):
# def get_year_month_day(day_content):
# def rec_list_splice(rec_list):
# def check_if_msg_line (line):
# def build_graphs(nick_sender, nick_receiver, time, year, month, day, day_graph, aggr_graph):
# def HACK_convert_nx_igraph(nx_graph):
# def extend_conversation_list(nick_sender, nick_receiver, conversation):
# def create_connected_nick_list(conn_comp_list):
# def correct_last_char_list(rec_list):
# def splice_find(line, search_param1, search_param2, splice_index):
# def get_nick_sen_rec(iter_range, nick_to_search, conn_comp_list, nick_sen_rec):
# def get_nick_representative(nicks, nick_same_list, nick_to_compare):
# def find_top_n_element_after_sorting(in_list, index, reverseBool, n):
# def count_number_of_users_on_channel(nick_same_list):
# def save_to_disk(data,file_name):
# def load_from_disk(file_name):
#     G = nx.Graph()


# Path: test/integration-test/test_lib/test_vis.py
import unittest
import os
import numpy as np
from lib import vis,util
from mock import patch



class VisTest(unittest.TestCase):
    def setUp(self):
        current_dir = os.path.dirname(os.path.abspath(__file__))
        self.test_data_dir = current_dir + "/../../data/test_lib/"

    def tearDown(self):
        self.test_data_dir = None

    def test_exponential_curve_fit_and_plot(self):
        data = util.load_from_disk(self.test_data_dir + "/vis/conv_len")
        expected_result = util.load_from_disk(self.test_data_dir + "/vis/conv_len_fit")

        output = vis.exponential_curve_fit_and_plot(data, self.test_data_dir, "exponential_plot_test")