aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_values.py
blob: 9ce93d13a5b82b1020b61398ae09d0dc7b2262fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from qface.generator import FileSystem
import logging
import logging.config
from path import Path


# logging.config.fileConfig('logging.ini')
logging.basicConfig()

log = logging.getLogger(__name__)

inputPath = Path('tests/in')


def loadValues():
    path = inputPath / 'values.qface'
    return FileSystem.parse_document(path)


def test_values():
    system = loadValues()
    assert system
    # lookup module
    interface = system.lookup('values.Namespace')
    assert interface
    properties = interface._propertyMap
    assert properties['intValue'].value == "99"
    assert properties['realValue'].value == "0.99"
    assert properties['message'].value == "foo"
    assert properties['person'].value == '{ name: "Hello", age: 101 }'
    struct = system.lookup('values.Person')
    assert struct
    fields = struct._fieldMap
    assert fields["name"].value == "hello"
    assert fields["age"].value == "99"