# Path: egasub/ega/entities/dataset.py
# class Dataset(object):
#     def __init__(self,alias,dataset_type_ids, policy_id, runs_references, analysis_references, title,
#                  dataset_links, attributes, description, id_=None, ega_accession_id=None):
#         self.alias = alias
#         self.dataset_type_ids = dataset_type_ids
#         self.policy_id = policy_id
#         self.runs_references = runs_references
#         self.analysis_references = analysis_references
#         self.title = title
#         self.dataset_links = dataset_links
#         self.attributes = attributes
#         self.id = id_
#         self.ega_accession_id = ega_accession_id
#         self.description = description
# 
#     def to_dict(self):
#         return {
#             'alias' : self.alias,
#             'datasetTypeIds' : self.dataset_type_ids,
#             'policyId' : self.policy_id,
#             'runsReferences' : self.runs_references,
#             'analysisReferences' : self.analysis_references,
#             'title' : self.title,
#             'description': self.description,
#             'datasetLinks' : map(lambda dataset_link: dataset_link.to_dict(), self.dataset_links),
#             'attributes' : map(lambda attribute: attribute.to_dict(), self.attributes),
#             'egaAccessionId': self.ega_accession_id
#         }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/dataset_link.py
# class DatasetLink(object):
#     def __init__(self,label,url):
#         self.label = label
#         self.url = url
# 
#     def to_dict(self):
#         return {
#             'label' : self.label,
#             'url' : self.url
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/attribute.py
# class Attribute(object):
#     def __init__(self, tag, value="", unit=None):
#         self.tag = tag
#         self.value = value
#         self.unit = unit
# 
# 
#     def to_dict(self):
#         return {
#             "tag": self.tag,
#             "value": self.value,
#             "unit": self.unit
#         }
# 
# 
#     def to_xml(self):
#         xml_string = "<TAG>%s</TAG>\n<VALUE>%s</VALUE>\n" % (self.tag, self.value)
#         if self.unit is not None:
#             xml_string += "<UNIT>%s</UNIT>\n" % (self.unit)
#         return xml_string
# 
#     @staticmethod
#     def from_dict(attr_dict):
#         return Attribute(attr_dict.get('tag'),attr_dict.get('value'),attr_dict.get('unit'))


from egasub.ega.entities.dataset import Dataset
from egasub.ega.entities.dataset_link import DatasetLink
from egasub.ega.entities.attribute import Attribute

links = [DatasetLink('label 1','url1'),DatasetLink('label 2','url2')]
attributes = [Attribute('The tag 1','The value 1','an unit'),Attribute('The tag 2','The value 2','an unit')]

dataset = Dataset('an alias',[3,4,5],3,[6,1,4],[8,21,4],'a title',links,attributes,'dataset description',None,'ega_accession_id')


def test_dataset_type_ids():
    assert [3,4,5] == dataset.dataset_type_ids

def test_policy_id():
    assert 3 == dataset.policy_id

def test_runs_references():
    assert [6,1,4] == dataset.runs_references

def test_analysis_references():
    assert [8,21,4] == dataset.analysis_references

def test_dataset_links():

# Path: egasub/ega/entities/dataset.py
# class Dataset(object):
#     def __init__(self,alias,dataset_type_ids, policy_id, runs_references, analysis_references, title,
#                  dataset_links, attributes, description, id_=None, ega_accession_id=None):
#         self.alias = alias
#         self.dataset_type_ids = dataset_type_ids
#         self.policy_id = policy_id
#         self.runs_references = runs_references
#         self.analysis_references = analysis_references
#         self.title = title
#         self.dataset_links = dataset_links
#         self.attributes = attributes
#         self.id = id_
#         self.ega_accession_id = ega_accession_id
#         self.description = description
# 
#     def to_dict(self):
#         return {
#             'alias' : self.alias,
#             'datasetTypeIds' : self.dataset_type_ids,
#             'policyId' : self.policy_id,
#             'runsReferences' : self.runs_references,
#             'analysisReferences' : self.analysis_references,
#             'title' : self.title,
#             'description': self.description,
#             'datasetLinks' : map(lambda dataset_link: dataset_link.to_dict(), self.dataset_links),
#             'attributes' : map(lambda attribute: attribute.to_dict(), self.attributes),
#             'egaAccessionId': self.ega_accession_id
#         }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/dataset_link.py
# class DatasetLink(object):
#     def __init__(self,label,url):
#         self.label = label
#         self.url = url
# 
#     def to_dict(self):
#         return {
#             'label' : self.label,
#             'url' : self.url
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/attribute.py
# class Attribute(object):
#     def __init__(self, tag, value="", unit=None):
#         self.tag = tag
#         self.value = value
#         self.unit = unit
# 
# 
#     def to_dict(self):
#         return {
#             "tag": self.tag,
#             "value": self.value,
#             "unit": self.unit
#         }
# 
# 
#     def to_xml(self):
#         xml_string = "<TAG>%s</TAG>\n<VALUE>%s</VALUE>\n" % (self.tag, self.value)
#         if self.unit is not None:
#             xml_string += "<UNIT>%s</UNIT>\n" % (self.unit)
#         return xml_string
# 
#     @staticmethod
#     def from_dict(attr_dict):
#         return Attribute(attr_dict.get('tag'),attr_dict.get('value'),attr_dict.get('unit'))


# Path: tests/test_dataset.py
from egasub.ega.entities.dataset import Dataset
from egasub.ega.entities.dataset_link import DatasetLink
from egasub.ega.entities.attribute import Attribute


links = [DatasetLink('label 1','url1'),DatasetLink('label 2','url2')]
attributes = [Attribute('The tag 1','The value 1','an unit'),Attribute('The tag 2','The value 2','an unit')]

dataset = Dataset('an alias',[3,4,5],3,[6,1,4],[8,21,4],'a title',links,attributes,'dataset description',None,'ega_accession_id')


def test_dataset_type_ids():
    assert [3,4,5] == dataset.dataset_type_ids

def test_policy_id():
    assert 3 == dataset.policy_id

def test_runs_references():
    assert [6,1,4] == dataset.runs_references

def test_analysis_references():
    assert [8,21,4] == dataset.analysis_references

def test_dataset_links():

    assert links == dataset.dataset_links