# Path: ob_pipelines/entities/persistence.py
# def get_sample_by_key(sample_key):
#     sample = Sample(**_get_record(sample_key, SAMPLE_TABLE))
#     sample.experiment = get_experiment_by_key(sample.sample['Experiment'][0])
#     return sample
# 
# def get_experiments() -> []:
#     experiments = _get_records(EXPT_TABLE)
#     for experiment in experiments:
#         yield Experiment(**experiment)
# 
# def get_samples():
#     samples = _get_records(SAMPLE_TABLE)
#     for sample in samples:
#         yield Sample(**sample)
# 
# def get_tasks():
#     tasks = _get_records(TASK_TABLE)
#     for task in tasks:
#         yield Task(**task)
# 
# def get_experiment_by_name(expt_name):
#     return Experiment(**_get_record_by_name(expt_name, EXPT_TABLE))


from ob_pipelines.entities.persistence import get_sample_by_key, get_experiments, get_samples, get_tasks, \
    get_experiment_by_name


class TestMetadataIntegrity:
    def test_experiment(self):
        experiment = get_experiment_by_name('EXPT-1')
        assert experiment is not None
        assert experiment.name == 'EXPT-1'

        for sample_id in experiment.Samples:
            sample = get_sample_by_key(sample_id)
            assert sample.sample['Name'] is not None
            assert sample.sample['FastQ 1'] is not None
            assert sample.sample['FastQ 2'] is not None


# Path: ob_pipelines/entities/persistence.py
# def get_sample_by_key(sample_key):
#     sample = Sample(**_get_record(sample_key, SAMPLE_TABLE))
#     sample.experiment = get_experiment_by_key(sample.sample['Experiment'][0])
#     return sample
# 
# def get_experiments() -> []:
#     experiments = _get_records(EXPT_TABLE)
#     for experiment in experiments:
#         yield Experiment(**experiment)
# 
# def get_samples():
#     samples = _get_records(SAMPLE_TABLE)
#     for sample in samples:
#         yield Sample(**sample)
# 
# def get_tasks():
#     tasks = _get_records(TASK_TABLE)
#     for task in tasks:
#         yield Task(**task)
# 
# def get_experiment_by_name(expt_name):
#     return Experiment(**_get_record_by_name(expt_name, EXPT_TABLE))


# Path: test/local/test_metadata.py
from ob_pipelines.entities.persistence import get_sample_by_key, get_experiments, get_samples, get_tasks, \
    get_experiment_by_name



class TestMetadataIntegrity:
    def test_experiment(self):
        experiment = get_experiment_by_name('EXPT-1')
        assert experiment is not None
        assert experiment.name == 'EXPT-1'

        for sample_id in experiment.Samples:
            sample = get_sample_by_key(sample_id)
            assert sample.sample['Name'] is not None
            assert sample.sample['FastQ 1'] is not None
            assert sample.sample['FastQ 2'] is not None


    def test_experiments(self):