# Path: disentanglement_lib/data/ground_truth/dummy_data.py
# class IdentityObservationsData(ground_truth_data.GroundTruthData):
# class DummyData(ground_truth_data.GroundTruthData):
#   def num_factors(self):
#   def observation_shape(self):
#   def factors_num_values(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
#   def factor_names(self):
#   def num_factors(self):
#   def factors_num_values(self):
#   def observation_shape(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
# 
# Path: disentanglement_lib/data/ground_truth/util.py
# def tf_data_set_from_ground_truth_data(ground_truth_data, random_seed):
#   def generator():
#   def __init__(self, factor_sizes, latent_factor_indices):
#   def num_latent_factors(self):
#   def sample_latent_factors(self, num, random_state):
#   def sample_all_factors(self, latent_factors, random_state):
#   def _sample_factor(self, i, num, random_state):
#   def __init__(self, factor_sizes, features):
#   def features_to_index(self, features):
#   def _features_to_state_space_index(self, features):
# class SplitDiscreteStateSpace(object):
# class StateSpaceAtomIndex(object):


from absl.testing import parameterized
from disentanglement_lib.data.ground_truth import dummy_data
from disentanglement_lib.data.ground_truth import util
from six.moves import range
import numpy as np
import tensorflow.compat.v1 as tf
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for util.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports


class UtilTest(parameterized.TestCase, tf.test.TestCase):

  def test_tfdata(self):
    ground_truth_data = dummy_data.DummyData()
    dataset = util.tf_data_set_from_ground_truth_data(ground_truth_data, 0)
    one_shot_iterator = dataset.make_one_shot_iterator()
    next_element = one_shot_iterator.get_next()
    with self.test_session() as sess:
      for _ in range(10):
        sess.run(next_element)


class StateSpaceAtomIndexTest(parameterized.TestCase, tf.test.TestCase):

  def test(self):
    features = np.array([[0, 1], [1, 0], [1, 1], [0, 0]], dtype=np.int64)

# Path: disentanglement_lib/data/ground_truth/dummy_data.py
# class IdentityObservationsData(ground_truth_data.GroundTruthData):
# class DummyData(ground_truth_data.GroundTruthData):
#   def num_factors(self):
#   def observation_shape(self):
#   def factors_num_values(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
#   def factor_names(self):
#   def num_factors(self):
#   def factors_num_values(self):
#   def observation_shape(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
# 
# Path: disentanglement_lib/data/ground_truth/util.py
# def tf_data_set_from_ground_truth_data(ground_truth_data, random_seed):
#   def generator():
#   def __init__(self, factor_sizes, latent_factor_indices):
#   def num_latent_factors(self):
#   def sample_latent_factors(self, num, random_state):
#   def sample_all_factors(self, latent_factors, random_state):
#   def _sample_factor(self, i, num, random_state):
#   def __init__(self, factor_sizes, features):
#   def features_to_index(self, features):
#   def _features_to_state_space_index(self, features):
# class SplitDiscreteStateSpace(object):
# class StateSpaceAtomIndex(object):


# Path: disentanglement_lib/data/ground_truth/util_test.py
from absl.testing import parameterized
from disentanglement_lib.data.ground_truth import dummy_data
from disentanglement_lib.data.ground_truth import util
from six.moves import range
import numpy as np
import tensorflow.compat.v1 as tf

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for util.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports


class UtilTest(parameterized.TestCase, tf.test.TestCase):

  def test_tfdata(self):
    ground_truth_data = dummy_data.DummyData()
    dataset = util.tf_data_set_from_ground_truth_data(ground_truth_data, 0)
    one_shot_iterator = dataset.make_one_shot_iterator()
    next_element = one_shot_iterator.get_next()
    with self.test_session() as sess:
      for _ in range(10):
        sess.run(next_element)


class StateSpaceAtomIndexTest(parameterized.TestCase, tf.test.TestCase):

  def test(self):
    features = np.array([[0, 1], [1, 0], [1, 1], [0, 0]], dtype=np.int64)

    state_space_atom_index = util.StateSpaceAtomIndex([2, 2], features)