Exemple #1
0
def test_Field():
    f = itsdb.Field('x', ':y', True, False, 'a comment')
    assert f.name == 'x'
    assert f.datatype == ':y'
    assert f.key is True
    assert f.partial == False
    assert f.comment == 'a comment'
    f = itsdb.Field('x', ':integer', False, False, '')
    assert f.default_value() == -1
    f = itsdb.Field('i-wf', ':integer', False, False, '')
    assert f.default_value() == 1
Exemple #2
0
def test_Field():
    f = itsdb.Field('x', ':y', True, [':other'], 'a comment')
    assert f.name == 'x'
    assert f.datatype == ':y'
    assert f.key is True
    assert f.other == [':other']
    assert f.comment == 'a comment'
Exemple #3
0
def test_get_relations(empty_profile):
    r = itsdb.get_relations(os.path.join(empty_profile, 'relations'))
    assert r['item'] == (itsdb.Field('i-id', ':integer', True, False, None),
                         itsdb.Field('i-input', ':string', False, False, None))
    assert r['parse'] == (itsdb.Field('parse-id', ':integer', True, False,
                                      'unique parse identifier'),
                          itsdb.Field('run-id', ':integer', True, False,
                                      'test run for this parse'),
                          itsdb.Field('i-id', ':integer', True, False,
                                      'item parsed'))
    assert r['result'] == (itsdb.Field('parse-id', ':integer', True, False,
                                       'parse for this result'),
                           itsdb.Field('result-id', ':integer', False, False,
                                       'result identifier'),
                           itsdb.Field('mrs', ':string', False, False,
                                       'MRS for this reading'))