# Path: idtxl/idtxl_utils.py
# def swap_chars(s, i_1, i_2):
# def print_dict(d, indent=4):
# def standardise(a, dimension=0, df=1):
# def sort_descending(a):
# def argsort_descending(a):
# def remove_row(a, i):
# def remove_column(a, j):
# def autocorrelation(x):
# def discretise(a, numBins):
# def discretise_max_ent(a, numBins):
# def separate_arrays(idx_all, idx_single, a):
# def combine_discrete_dimensions(a, numBins):
# def equal_dicts(dict_1, dict_2):
# def conflicting_entries(dict_1, dict_2):
# def calculate_mi(corr):


import numpy as np
from idtxl import idtxl_utils as utils
"""Unit tests for IDTxl utilities module."""


def test_swap_chars():
    """Test swapping of characters in a string."""
    s = utils.swap_chars('psr', 0, 1)
    assert s == 'spr', 'Chars were not swapped correctly.'


def test_combine_discrete_dimensions():
    combined = utils.combine_discrete_dimensions(
        np.array([[1, 0, 1], [0, 1, 0]]), 2)
    assert type(combined) == np.ndarray
    assert (type(combined[0]) == np.int32) or (type(combined[0]) == np.int64)
    assert len(combined.shape) == 1
    assert combined.shape[0] == 2
    assert combined[0] == 5
    assert combined[1] == 2

# Path: idtxl/idtxl_utils.py
# def swap_chars(s, i_1, i_2):
# def print_dict(d, indent=4):
# def standardise(a, dimension=0, df=1):
# def sort_descending(a):
# def argsort_descending(a):
# def remove_row(a, i):
# def remove_column(a, j):
# def autocorrelation(x):
# def discretise(a, numBins):
# def discretise_max_ent(a, numBins):
# def separate_arrays(idx_all, idx_single, a):
# def combine_discrete_dimensions(a, numBins):
# def equal_dicts(dict_1, dict_2):
# def conflicting_entries(dict_1, dict_2):
# def calculate_mi(corr):


# Path: test/test_idtxl_utils.py
import numpy as np
from idtxl import idtxl_utils as utils

"""Unit tests for IDTxl utilities module."""


def test_swap_chars():
    """Test swapping of characters in a string."""
    s = utils.swap_chars('psr', 0, 1)
    assert s == 'spr', 'Chars were not swapped correctly.'


def test_combine_discrete_dimensions():
    combined = utils.combine_discrete_dimensions(
        np.array([[1, 0, 1], [0, 1, 0]]), 2)
    assert type(combined) == np.ndarray
    assert (type(combined[0]) == np.int32) or (type(combined[0]) == np.int64)
    assert len(combined.shape) == 1
    assert combined.shape[0] == 2
    assert combined[0] == 5
    assert combined[1] == 2

    combined = utils.combine_discrete_dimensions(