Beispiel #1
0
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)


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():
Beispiel #2
0
from egasub.ega.entities.sample import Sample
from egasub.ega.entities.attribute import Attribute

attributes = [Attribute('tag1', 'value1'), Attribute('tag2', 'value2')]
sample = Sample('an alias', 'the title', 'the description', 123, 2, 'head',
                'test line', 'test region', 'a phenotype', 33,
                'anonymized name', 22, 10, 'some details', attributes, 33)


def test_title():
    assert 'the title' == sample.title


def test_description():
    assert 'the description' == sample.description


def test_case_or_control_id():
    assert 123 == sample.case_or_control_id


def test_gender_id():
    assert 2 == sample.gender_id


def test_organism_part():
    assert 'head' == sample.organism_part


def test_cell_line():
    assert 'test line' == sample.cell_line
Beispiel #3
0
from egasub.ega.entities.attribute import Attribute

attribute = Attribute('The tag', 'The value', 'an unit')


def test_tag():
    assert 'The tag' == attribute.tag


def test_value():
    assert 'The value' == attribute.value


def test_unit():
    assert 'an unit' == attribute.unit


def test_to_dict():
    assert cmp({
        'tag': 'The tag',
        'value': 'The value',
        'unit': 'an unit'
    }, attribute.to_dict()) == 0


def test_to_xml():
    assert attribute.to_xml(
    ) == '<TAG>The tag</TAG>\n<VALUE>The value</VALUE>\n<UNIT>an unit</UNIT>\n'


def test_from_dict():