# Path: pyphi/constants.py
# EPSILON = None
# FILESYSTEM = "fs"
# DATABASE = "db"
# PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL
# OFF = (0,)
# ON = (1,)
# 
# Path: pyphi/utils.py
# def state_of(nodes, network_state):
# def all_states(n, big_endian=False):
# def np_immutable(a):
# def np_hash(a):
#     def __init__(self, array):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __repr__(self):
# def eq(x, y):
# def combs(a, r):
# def comb_indices(n, k):
# def powerset(iterable, nonempty=False, reverse=False):
# def load_data(directory, num):
#     def get_path(i):  # pylint: disable=missing-docstring
# def time_annotated(func, *args, **kwargs):
# class np_hashable:


from unittest.mock import patch
from pyphi import constants, utils
import numpy as np
    # fmt: on
    assert np.array_equal(data[:, utils.comb_indices(n, k)], answer)


def test_powerset():
    a = np.arange(2)
    assert list(utils.powerset(a)) == [(), (0,), (1,), (0, 1)]


def test_powerset_takes_iterable():
    a = iter([0, 1])
    assert list(utils.powerset(a)) == [(), (0,), (1,), (0, 1)]


def test_np_hashable():
    a = np.ones((2, 2))
    a_hashable = utils.np_hashable(a)
    s = set([a_hashable])
    assert a_hashable in s
    s.add(a_hashable)
    assert len(s) == 1

    b = np.zeros((2, 2))
    b_hashable = utils.np_hashable(b)
    assert b_hashable not in s
    s.add(b_hashable)
    assert len(s) == 2

    c = np.zeros((2, 2))
    c_hashable = utils.np_hashable(c)

# Path: pyphi/constants.py
# EPSILON = None
# FILESYSTEM = "fs"
# DATABASE = "db"
# PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL
# OFF = (0,)
# ON = (1,)
# 
# Path: pyphi/utils.py
# def state_of(nodes, network_state):
# def all_states(n, big_endian=False):
# def np_immutable(a):
# def np_hash(a):
#     def __init__(self, array):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __repr__(self):
# def eq(x, y):
# def combs(a, r):
# def comb_indices(n, k):
# def powerset(iterable, nonempty=False, reverse=False):
# def load_data(directory, num):
#     def get_path(i):  # pylint: disable=missing-docstring
# def time_annotated(func, *args, **kwargs):
# class np_hashable:


# Path: test/test_utils.py
from unittest.mock import patch
from pyphi import constants, utils
import numpy as np

    # fmt: on
    assert np.array_equal(data[:, utils.comb_indices(n, k)], answer)


def test_powerset():
    a = np.arange(2)
    assert list(utils.powerset(a)) == [(), (0,), (1,), (0, 1)]


def test_powerset_takes_iterable():
    a = iter([0, 1])
    assert list(utils.powerset(a)) == [(), (0,), (1,), (0, 1)]


def test_np_hashable():
    a = np.ones((2, 2))
    a_hashable = utils.np_hashable(a)
    s = set([a_hashable])
    assert a_hashable in s
    s.add(a_hashable)
    assert len(s) == 1

    b = np.zeros((2, 2))
    b_hashable = utils.np_hashable(b)
    assert b_hashable not in s
    s.add(b_hashable)
    assert len(s) == 2

    c = np.zeros((2, 2))
    c_hashable = utils.np_hashable(c)

    assert c_hashable == b_hashable