def test_device_modeltype_not_equal(pathlist=None): pt1a = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt1b = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt2a = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) pt2b = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) bt1a = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1b = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1a.points[pt1a.id] = pt1a bt1a.points[pt2a.id] = pt2a bt1b.points[pt1b.id] = pt1b bt1b.points[pt2b.id] = pt2b bt2a = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) bt2b = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) mt1 = device.ModelType(1) mt2 = device.ModelType(1) mt1.fixed_block = bt1a mt1.repeating_block = bt2a mt2.fixed_block = bt1b mt2.repeating_block = bt2b try: not_equal = mt1.not_equal(mt2) if not_equal: raise Exception(not_equal) except Exception, e: print '*** Failure test_device_blocktype_not_equal: %s' % str(e) return False
def test_device_blocktype_not_equal(pathlist=None): pt1a = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt1b = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt2a = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) pt2b = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) bt1a = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1b = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1a.points[pt1a.id] = pt1a bt1a.points[pt2a.id] = pt2a bt1b.points[pt1b.id] = pt1b bt1b.points[pt2b.id] = pt2b bt2a = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) bt2b = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) try: not_equal = bt1a.not_equal(bt1b) if not_equal: raise Exception(not_equal) not_equal = bt2a.not_equal(bt2b) if not_equal: raise Exception(not_equal) except Exception, e: print '*** Failure test_device_blocktype_not_equal: %s' % str(e) return False
def test_device_pointtype_not_equal(self): pt1 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) pt2 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) pt3 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) not_equal = pt1.not_equal(pt2) if not_equal: raise Exception(not_equal) not_equal = pt1.not_equal(pt3) if not_equal: raise Exception(not_equal)
def test_device_pointtype_not_equal(pathlist=None): pt1 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) pt2 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) pt3 = device.PointType('point_1', 0, smdx.SMDX_TYPE_INT16) try: not_equal = pt1.not_equal(pt2) if not_equal: raise Exception(not_equal) not_equal = pt1.not_equal(pt3) if not_equal: raise Exception(not_equal) except Exception, e: print '*** Failure test_device_pointtype_not_equal: %s' % str(e) return False
def test_device_blocktype_not_equal(self): pt1a = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt1b = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt2a = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) pt2b = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) bt1a = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1b = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1a.points[pt1a.id] = pt1a bt1a.points[pt2a.id] = pt2a bt1b.points[pt1b.id] = pt1b bt1b.points[pt2b.id] = pt2b bt2a = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) bt2b = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) not_equal = bt1a.not_equal(bt1b) if not_equal: raise Exception(not_equal) not_equal = bt2a.not_equal(bt2b) if not_equal: raise Exception(not_equal)
def test_device_pointtype(self): points = {} block = ET.fromstring(test_device_pointtype_smdx_2) for p in block.findall('*'): pt = device.PointType() pt.from_smdx(p) points[p.attrib.get(smdx.SMDX_ATTR_ID)] = pt pt = points.get('p_int16') if (pt.id != 'p_int16' or pt.offset != 0 or pt.type != suns.SUNS_TYPE_INT16 or pt.len != 1): raise Exception('p_int16 error')
def test_device_modeltype_not_equal(self): pt1a = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt1b = device.PointType('point_1', 0, suns.SUNS_TYPE_INT16) pt2a = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) pt2b = device.PointType('point_2', 0, suns.SUNS_TYPE_UINT16) bt1a = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1b = device.BlockType(suns.SUNS_BLOCK_FIXED, 20) bt1a.points[pt1a.id] = pt1a bt1a.points[pt2a.id] = pt2a bt1b.points[pt1b.id] = pt1b bt1b.points[pt2b.id] = pt2b bt2a = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) bt2b = device.BlockType(suns.SUNS_BLOCK_REPEATING, 30) mt1 = device.ModelType(1) mt2 = device.ModelType(1) mt1.fixed_block = bt1a mt1.repeating_block = bt2a mt2.fixed_block = bt1b mt2.repeating_block = bt2b not_equal = mt1.not_equal(mt2) if not_equal: raise Exception(not_equal)
def test_device_pointtype(pathlist=None): points = {} try: block = ET.fromstring(test_device_pointtype_smdx_2) for p in block.findall('*'): pt = device.PointType() pt.from_smdx(p) points[p.attrib.get(smdx.SMDX_ATTR_ID)] = pt pt = points.get('p_int16') if (pt.id != 'p_int16' or pt.offset != 0 or pt.type != suns.SUNS_TYPE_INT16 or pt.len != 1): raise Exception('p_int16 error') except Exception, e: print '*** Failure test_device_pointtype: %s' % (str(e)) return False