# 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test/test_utils.py





def test_all_states():
    assert list(utils.all_states(0)) == []
    assert list(utils.all_states(1)) == [(0,), (1,)]
    states = [
        (0, 0, 0),
        (1, 0, 0),
        (0, 1, 0),
        (1, 1, 0),
        (0, 0, 1),
        (1, 0, 1),
        (0, 1, 1),
        (1, 1, 1),
    ]
    assert list(utils.all_states(3)) == states
    assert list(utils.all_states(3, big_endian=True)) == [
        tuple(reversed(state)) for state in states
    ]


def test_eq():
    phi = 0.5
    close_enough = phi - constants.EPSILON / 2

# 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

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test/test_utils.py





def test_all_states():
    assert list(utils.all_states(0)) == []
    assert list(utils.all_states(1)) == [(0,), (1,)]
    states = [
        (0, 0, 0),
        (1, 0, 0),
        (0, 1, 0),
        (1, 1, 0),
        (0, 0, 1),
        (1, 0, 1),
        (0, 1, 1),
        (1, 1, 1),
    ]
    assert list(utils.all_states(3)) == states
    assert list(utils.all_states(3, big_endian=True)) == [
        tuple(reversed(state)) for state in states
    ]


def test_eq():
    phi = 0.5
    close_enough = phi - constants.EPSILON / 2

    not_quite = phi - constants.EPSILON * 2