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_modeltype(self): mt = device.ModelType() root = ET.fromstring(test_device_pointtype_smdx_1) mt.from_smdx(root) if mt.id != 63001 or mt.len != 152: raise Exception('model type attribute error: id = %s len = %d' % (mt.id, mt.len))
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_modeltype(pathlist=None): mt = device.ModelType() try: root = ET.fromstring(test_device_pointtype_smdx_1) mt.from_smdx(root) if mt.id != 63001 or mt.len != 152: raise Exception('model type attribute error: id = %s len = %d' % (mt.id, mt.len)) except Exception, e: raise print '*** Failure test_device_modeltype: %s' % (str(e)) return False