Exemplo n.º 1
0
    def test_DoubleVal(self):
        pvn = pvnames.double_pv
        chid = ca.create_channel(pvn,connect=True)
        cdict  = ca.get_ctrlvars(chid)
        write( 'CA testing CTRL Values for a Double (%s)'   % (pvn))
        self.failUnless('units' in cdict)
        self.failUnless('precision' in cdict)
        self.failUnless('severity' in cdict)

        hostname = ca.host_name(chid)
        self.failUnless(len(hostname) > 1)

        count = ca.element_count(chid)
        self.assertEqual(count,1)

        ftype= ca.field_type(chid)
        self.assertEqual(ftype,ca.dbr.DOUBLE)

        prec = ca.get_precision(chid)
        self.assertEqual(prec, pvnames.double_pv_prec)

        units= ca.BYTES2STR(ca.get_ctrlvars(chid)['units'])
        self.assertEqual(units, pvnames.double_pv_units)

        rwacc= ca.access(chid)
        self.failUnless(rwacc.startswith('read'))
Exemplo n.º 2
0
    def test_DoubleVal(self):
        pvn = pvnames.double_pv
        chid = ca.create_channel(pvn,connect=True)
        cdict  = ca.get_ctrlvars(chid)
        write( 'CA testing CTRL Values for a Double (%s)'   % (pvn))
        self.failUnless('units' in cdict)
        self.failUnless('precision' in cdict)
        self.failUnless('severity' in cdict)

        hostname = ca.host_name(chid)
        self.failUnless(len(hostname) > 1)

        count = ca.element_count(chid)
        self.assertEqual(count,1)

        ftype= ca.field_type(chid)
        self.assertEqual(ftype,ca.dbr.DOUBLE)

        prec = ca.get_precision(chid)
        self.assertEqual(prec, pvnames.double_pv_prec)

        units= ca.bytes2str(ca.get_ctrlvars(chid)['units'])
        self.assertEqual(units, pvnames.double_pv_units)

        rwacc= ca.access(chid)
        self.failUnless(rwacc.startswith('read'))
Exemplo n.º 3
0
    def testA_CreateChid_CheckTypeCount(self):
        write('Simple Test: create chid, check count, type, host, and access')
        chid = ca.create_channel(pvnames.double_pv)
        ret = ca.connect_channel(chid)
        ca.pend_event(1.e-3)

        ftype  = ca.field_type(chid)
        count  = ca.element_count(chid)
        host    = ca.host_name(chid)
        rwacc = ca.access(chid)

        self.assertIsNot(chid, None)
        self.assertIsNot(host, None)
        self.assertEqual(count, 1)
        self.assertEqual(ftype, 6)
        self.assertEqual(rwacc,'read/write')
Exemplo n.º 4
0
    def testA_CreateChid_CheckTypeCount(self):
        write('Simple Test: create chid, check count, type, host, and access')
        chid = ca.create_channel(pvnames.double_pv)
        ret = ca.connect_channel(chid)
        ca.pend_event(1.e-3)

        ftype  = ca.field_type(chid)
        count  = ca.element_count(chid)
        host    = ca.host_name(chid)
        rwacc = ca.access(chid)

        self.assertNotEqual(chid, None)
        self.assertNotEqual(host, None)
        self.assertEqual(count, 1)
        self.assertEqual(ftype, 6)
        self.assertEqual(rwacc,'read/write')
Exemplo n.º 5
0
def test_CreateChid_CheckTypeCount():
    write('Simple Test: create chid, check count, type, host, and access')
    chid = ca.create_channel(pvnames.double_pv)
    ret = ca.connect_channel(chid)
    ca.pend_event(1.e-3)

    ftype = ca.field_type(chid)
    count = ca.element_count(chid)
    host = ca.host_name(chid)
    rwacc = ca.access(chid)

    assert chid is not None
    assert host is not None
    assert count == 1
    assert ftype == 6
    assert rwacc == 'read/write'
Exemplo n.º 6
0
def test_DoubleVal():
    pvn = pvnames.double_pv
    chid = ca.create_channel(pvn, connect=True)
    cdict = ca.get_ctrlvars(chid)
    write('CA testing CTRL Values for a Double (%s)' % (pvn))
    assert 'units' in cdict
    assert 'precision' in cdict
    assert 'severity' in cdict

    assert len(ca.host_name(chid)) > 2
    assert ca.element_count(chid) == 1

    assert ca.field_type(chid) == ca.dbr.DOUBLE
    assert ca.get_precision(chid) == pvnames.double_pv_prec
    assert ca.get_ctrlvars(chid)['units'] == pvnames.double_pv_units
    assert ca.access(chid).startswith('read')
Exemplo n.º 7
0
import time
import sys
from epics import ca

import pvnames

pvname = pvnames.double_pv
host = pvnames.double_pv_host

chid = ca.create_channel(pvname)
ret = ca.connect_channel(chid)
ca.pend_event(1.e-3)

ftype = ca.field_type(chid)
count = ca.element_count(chid)
host = ca.host_name(chid)
rwacc = ca.access(chid)

if ftype == 6 and count == 1 and host.startswith(host) and rwacc.startswith(
        'read'):
    sys.stdout.write('OK!\n')
else:
    sys.stdout.write("Error\n")
Exemplo n.º 8
0
import time
import sys
from epics import ca

import pvnames

pvname = pvnames.double_pv
host      = pvnames.double_pv_host


chid = ca.create_channel(pvname)
ret   = ca.connect_channel(chid)
ca.pend_event(1.e-3)
 
ftype  = ca.field_type(chid)
count  = ca.element_count(chid)
host    = ca.host_name(chid)
rwacc = ca.access(chid)
 
if  ftype ==6 and count == 1 and host.startswith(host) and rwacc.startswith('read'):
    sys.stdout.write('OK!\n')
else:
    sys.stdout.write("Error\n")