# Path: lib/analysis/channel.py
# def conv_len_conv_refr_time(log_dict, nicks, nick_same_list, rt_cutoff_time, cutoff_percentile):
#     def build_conversation(rec_list, nick, send_time, nick_to_search,
#                            nick_receiver, nick_sender, dateadd,
#                            conversations, conn_comp_list, line):
#     def conv_helper(rec, nick, send_time, nick_to_search, nick_receiver,
#                     nick_sender, dateadd, conversations, conn_comp_list, line):
#     def conv_mat_diff(i,j,conversations):
#     def conv_append(conversations, index, dateadd, line):
#     def parse_log_lines_for_conv(log_dict, nicks, conn_comp_list, conversations):
# def response_time(log_dict, nicks, nick_same_list, cutoff_percentile):
#     def build_mean_list(conversations, index, mean_list):
#     def resp_helper(rec, nick, send_time, nick_to_search, nick_receiver, nick_sender, conversations, conn_comp_list):
# def build_stat_dist(number_list):
# def truncate_table(table, cutoff_percentile):
#     G = util.to_graph(nick_same_list)
#     G = util.to_graph(nick_same_list)


import unittest
import lib.util as util
import os
from lib.analysis import channel
from mock import patch

    @patch("lib.analysis.channel.truncate_table", autospec=True)
    @patch("lib.analysis.channel.build_stat_dist")
    @patch("lib.util.splice_find", autospec=True)
    @patch("lib.util.check_if_msg_line", autospec=True)
    @patch("lib.util.rec_list_splice", autospec=True)
    @patch("lib.util.correctLastCharCR", autospec=True)
    @patch("lib.util.correct_last_char_list", autospec=True)
    @patch("lib.util.get_nick_sen_rec", autospec=True)
    @patch("lib.util.create_connected_nick_list", autospec=True)
    @patch("lib.util.to_graph", autospec=True)
    def test_conv_len_conv_refr_time(self,mock_to_graph, mock_connected_nick_list, mock_nick_sen,\
                                     mock_correct_last_char_list,mock_correct_last_char_CR, mock_rec_list_splice,\
                                     mock_msg_line,mock_splice_find, mock_stat_dist, mock_truncate_table):
        mock_to_graph.return_value = self.to_graph
        mock_connected_nick_list.side_effect = self.mock_create_connected_nick_list
        mock_nick_sen.side_effect = self.mock_get_nick_sen_rec
        mock_correct_last_char_list.side_effect = self.mock_correct_last_char_list
        mock_correct_last_char_CR.side_effect = self.mock_correctLastCharCR
        mock_rec_list_splice.side_effect = self.mock_rec_list_splice
        mock_msg_line.side_effect = self.mock_check_if_msg_line
        mock_splice_find.side_effect = self.mock_splice_find
        mock_truncate_table.side_effect = [util.load_from_disk(self.test_data_dir + "/channel/truncate_cl"),
                                           util.load_from_disk(self.test_data_dir + "/channel/truncate_crt")]
        rt_cutoff_time = 1
        cutoff_percentile = 0
        expected_conv_len = util.load_from_disk(self.test_data_dir + "/channel/conv_len")
        expected_conv_ref_time = util.load_from_disk(self.test_data_dir+ "/channel/conv_ref_time")

        conv_len, conv_ref_time = \

# Path: lib/analysis/channel.py
# def conv_len_conv_refr_time(log_dict, nicks, nick_same_list, rt_cutoff_time, cutoff_percentile):
#     def build_conversation(rec_list, nick, send_time, nick_to_search,
#                            nick_receiver, nick_sender, dateadd,
#                            conversations, conn_comp_list, line):
#     def conv_helper(rec, nick, send_time, nick_to_search, nick_receiver,
#                     nick_sender, dateadd, conversations, conn_comp_list, line):
#     def conv_mat_diff(i,j,conversations):
#     def conv_append(conversations, index, dateadd, line):
#     def parse_log_lines_for_conv(log_dict, nicks, conn_comp_list, conversations):
# def response_time(log_dict, nicks, nick_same_list, cutoff_percentile):
#     def build_mean_list(conversations, index, mean_list):
#     def resp_helper(rec, nick, send_time, nick_to_search, nick_receiver, nick_sender, conversations, conn_comp_list):
# def build_stat_dist(number_list):
# def truncate_table(table, cutoff_percentile):
#     G = util.to_graph(nick_same_list)
#     G = util.to_graph(nick_same_list)


# Path: test/unit-test/test_lib/test_analysis/test_channel.py
import unittest
import lib.util as util
import os
from lib.analysis import channel
from mock import patch


    @patch("lib.analysis.channel.truncate_table", autospec=True)
    @patch("lib.analysis.channel.build_stat_dist")
    @patch("lib.util.splice_find", autospec=True)
    @patch("lib.util.check_if_msg_line", autospec=True)
    @patch("lib.util.rec_list_splice", autospec=True)
    @patch("lib.util.correctLastCharCR", autospec=True)
    @patch("lib.util.correct_last_char_list", autospec=True)
    @patch("lib.util.get_nick_sen_rec", autospec=True)
    @patch("lib.util.create_connected_nick_list", autospec=True)
    @patch("lib.util.to_graph", autospec=True)
    def test_conv_len_conv_refr_time(self,mock_to_graph, mock_connected_nick_list, mock_nick_sen,\
                                     mock_correct_last_char_list,mock_correct_last_char_CR, mock_rec_list_splice,\
                                     mock_msg_line,mock_splice_find, mock_stat_dist, mock_truncate_table):
        mock_to_graph.return_value = self.to_graph
        mock_connected_nick_list.side_effect = self.mock_create_connected_nick_list
        mock_nick_sen.side_effect = self.mock_get_nick_sen_rec
        mock_correct_last_char_list.side_effect = self.mock_correct_last_char_list
        mock_correct_last_char_CR.side_effect = self.mock_correctLastCharCR
        mock_rec_list_splice.side_effect = self.mock_rec_list_splice
        mock_msg_line.side_effect = self.mock_check_if_msg_line
        mock_splice_find.side_effect = self.mock_splice_find
        mock_truncate_table.side_effect = [util.load_from_disk(self.test_data_dir + "/channel/truncate_cl"),
                                           util.load_from_disk(self.test_data_dir + "/channel/truncate_crt")]
        rt_cutoff_time = 1
        cutoff_percentile = 0
        expected_conv_len = util.load_from_disk(self.test_data_dir + "/channel/conv_len")
        expected_conv_ref_time = util.load_from_disk(self.test_data_dir+ "/channel/conv_ref_time")

        conv_len, conv_ref_time = \

            channel.conv_len_conv_refr_time(self.log_data, self.nicks, self.nick_same_list,