# Path: alfpy/lempelziv.py
# def complexity(s):
# def complexity1(seq):
# def is_reproducible(seq, index, hist_len, last_match=0):
#     def __init__(self, seq_records, disttype='d1_star'):
#     def __precompute_complexity(self):
#     def __get_complexity(self, seq1idx, seq2idx):
#     def pwdist_d(self, seq1idx, seq2idx):
#     def pwdist_d_star(self, seq1idx, seq2idx):
#     def pwdist_d1(self, seq1idx, seq2idx):
#     def pwdist_d1_star(self, seq1idx, seq2idx):
#     def pwdist_d1_star2(self, seq1idx, seq2idx):
#     def set_disttype(self, disttype):
# def main():
# class Distance:
# 
# Path: alfpy/utils/distmatrix.py
# def create(id_list, distance):
# def read_highcharts_matrix(id_list, data):
#     def __init__(self, id_list, data):
#     def normalize(self):
#     def __iter__(self):
#     def writer(self, handle, f, decimal_places):
#     def display(self, f="phylip", decimal_places=7):
#     def write_to_file(self, handle, f="phylip", decimal_places=7):
#     def highcharts(self):
#     def format(self, decimal_places=7):
#     def min(self):
#     def max(self):
#     def is_zero(self):
#     def __repr__(self):
# class Matrix():


import unittest
from alfpy import lempelziv
from alfpy.utils import distmatrix
from . import utils
        dist = lempelziv.Distance(self.pep_records)
        exp = [((0,), 40), ((0, 1), 47), ((0, 2), 53),
               ((0, 3), 43), ((1,), 38), ((1, 0), 47),
               ((1, 2), 47), ((1, 3), 41), ((2,), 35),
               ((2, 0), 50), ((2, 1), 45), ((2, 3), 37),
               ((3,), 19), ((3, 0), 39), ((3, 1), 37),
               ((3, 2), 36)]
        self.assertEqual(sorted(dist._complexity.items()), exp)


class DistanceTest(unittest.TestCase, utils.ModulesCommonTest):

    def __init__(self, *args, **kwargs):
        super(DistanceTest, self).__init__(*args, **kwargs)
        utils.ModulesCommonTest.set_test_data()
        self.dist = lempelziv.Distance(self.pep_records, 'd')

    def test_distance_d(self):
        matrix = distmatrix.create(self.pep_records.id_list, self.dist)
        exp = [
            "   4",
            "seq1       0 9 15 20",
            "seq2       9 0 10 18",
            "seq3       15 10 0 17",
            "seq4       20 18 17 0"
        ]
        self.assertEqual(matrix.format(decimal_places=0), "\n".join(exp))

    def test_distance_d_star(self):
        self.dist.set_disttype('d_star')

# Path: alfpy/lempelziv.py
# def complexity(s):
# def complexity1(seq):
# def is_reproducible(seq, index, hist_len, last_match=0):
#     def __init__(self, seq_records, disttype='d1_star'):
#     def __precompute_complexity(self):
#     def __get_complexity(self, seq1idx, seq2idx):
#     def pwdist_d(self, seq1idx, seq2idx):
#     def pwdist_d_star(self, seq1idx, seq2idx):
#     def pwdist_d1(self, seq1idx, seq2idx):
#     def pwdist_d1_star(self, seq1idx, seq2idx):
#     def pwdist_d1_star2(self, seq1idx, seq2idx):
#     def set_disttype(self, disttype):
# def main():
# class Distance:
# 
# Path: alfpy/utils/distmatrix.py
# def create(id_list, distance):
# def read_highcharts_matrix(id_list, data):
#     def __init__(self, id_list, data):
#     def normalize(self):
#     def __iter__(self):
#     def writer(self, handle, f, decimal_places):
#     def display(self, f="phylip", decimal_places=7):
#     def write_to_file(self, handle, f="phylip", decimal_places=7):
#     def highcharts(self):
#     def format(self, decimal_places=7):
#     def min(self):
#     def max(self):
#     def is_zero(self):
#     def __repr__(self):
# class Matrix():


# Path: tests/test_lempelziv.py
import unittest
from alfpy import lempelziv
from alfpy.utils import distmatrix
from . import utils

        dist = lempelziv.Distance(self.pep_records)
        exp = [((0,), 40), ((0, 1), 47), ((0, 2), 53),
               ((0, 3), 43), ((1,), 38), ((1, 0), 47),
               ((1, 2), 47), ((1, 3), 41), ((2,), 35),
               ((2, 0), 50), ((2, 1), 45), ((2, 3), 37),
               ((3,), 19), ((3, 0), 39), ((3, 1), 37),
               ((3, 2), 36)]
        self.assertEqual(sorted(dist._complexity.items()), exp)


class DistanceTest(unittest.TestCase, utils.ModulesCommonTest):

    def __init__(self, *args, **kwargs):
        super(DistanceTest, self).__init__(*args, **kwargs)
        utils.ModulesCommonTest.set_test_data()
        self.dist = lempelziv.Distance(self.pep_records, 'd')

    def test_distance_d(self):
        matrix = distmatrix.create(self.pep_records.id_list, self.dist)
        exp = [
            "   4",
            "seq1       0 9 15 20",
            "seq2       9 0 10 18",
            "seq3       15 10 0 17",
            "seq4       20 18 17 0"
        ]
        self.assertEqual(matrix.format(decimal_places=0), "\n".join(exp))

    def test_distance_d_star(self):
        self.dist.set_disttype('d_star')

        matrix = distmatrix.create(self.pep_records.id_list, self.dist)