# Path: deepcpg/data/hdf.py
# def _ls(item, recursive=False, groups=False, level=0):
# def ls(filename, group='/', recursive=False, groups=False,
#        regex=None, nb_key=None, must_exist=True):
# def write_data(data, filename):
# def hnames_to_names(hnames):
# def reader(data_files, names, batch_size=128, nb_sample=None, shuffle=False,
#            loop=False):
# def _to_dict(data):
# def read_from(reader, nb_sample=None):
# def read(data_files, names, nb_sample=None, batch_size=1024, *args, **kwargs):


from collections import OrderedDict
from numpy import testing as npt
from six.moves import range
from deepcpg.data import hdf
import os
import h5py as h5
import numpy as np
import six
from __future__ import division
from __future__ import print_function





def test_hnames_to_names():
    hnames = OrderedDict.fromkeys(['a', 'b'])
    names = hdf.hnames_to_names(hnames)
    assert names == ['a', 'b']

    hnames = OrderedDict()
    hnames['a'] = ['a1', 'a2']
    hnames['b'] = ['b1', 'b2']
    names = hdf.hnames_to_names(hnames)
    assert names == ['a/a1', 'a/a2', 'b/b1', 'b/b2']

    hnames = OrderedDict()
    hnames['a'] = 'a1'
    hnames['b'] = ['b1', 'b2']
    hnames['c'] = None
    names = hdf.hnames_to_names(hnames)
    assert names == ['a/a1', 'b/b1', 'b/b2', 'c']


class TestReader(object):

    def setup(self):
        self.data_path = os.path.join(

# Path: deepcpg/data/hdf.py
# def _ls(item, recursive=False, groups=False, level=0):
# def ls(filename, group='/', recursive=False, groups=False,
#        regex=None, nb_key=None, must_exist=True):
# def write_data(data, filename):
# def hnames_to_names(hnames):
# def reader(data_files, names, batch_size=128, nb_sample=None, shuffle=False,
#            loop=False):
# def _to_dict(data):
# def read_from(reader, nb_sample=None):
# def read(data_files, names, nb_sample=None, batch_size=1024, *args, **kwargs):


# Path: tests/deepcpg/data/test_hdf.py
from collections import OrderedDict
from numpy import testing as npt
from six.moves import range
from deepcpg.data import hdf
import os
import h5py as h5
import numpy as np
import six

from __future__ import division
from __future__ import print_function





def test_hnames_to_names():
    hnames = OrderedDict.fromkeys(['a', 'b'])
    names = hdf.hnames_to_names(hnames)
    assert names == ['a', 'b']

    hnames = OrderedDict()
    hnames['a'] = ['a1', 'a2']
    hnames['b'] = ['b1', 'b2']
    names = hdf.hnames_to_names(hnames)
    assert names == ['a/a1', 'a/a2', 'b/b1', 'b/b2']

    hnames = OrderedDict()
    hnames['a'] = 'a1'
    hnames['b'] = ['b1', 'b2']
    hnames['c'] = None
    names = hdf.hnames_to_names(hnames)
    assert names == ['a/a1', 'b/b1', 'b/b2', 'c']


class TestReader(object):

    def setup(self):
        self.data_path = os.path.join(

            os.path.dirname(os.path.realpath(__file__)),