def testCopy(self): b = BlockInfo(None, "/Foo", False, "") b.addUserParam("p0", "val0") b.addUserParam("p1", "val1") b2 = BlockInfo(None, "/Foo/bar", False, "") b2.addUserParam("p2", "val2") b2.addUserParam("p3", "val3") b3 = BlockInfo(None, "/Foo/bar1", False, "") b3.addUserParam("p4", "val4") b3.addUserParam("p5", "val5") b.addChildBlock(b2) b.addChildBlock(b3) b.setStarInfo(BlockInfo(None, "Foo/star", False, "")) b.addBlockType(BlockInfo(None, "Foo/t", False, "")) b_copy = b.copy(None) self.assertNotEqual(b_copy, b) self.assertEqual(b_copy.name, b.name) self.assertEqual(b_copy.types.keys(), b.types.keys()) self.assertNotEqual(b_copy.types, b.types) self.assertEqual(b_copy.children.keys(), b.children.keys()) self.assertEqual(b_copy.children_list, b.children_list) self.assertEqual(b_copy.parameters_list, b.parameters_list) self.assertEqual(b_copy.parameters.keys(), b.parameters.keys()) o = b.dump() o1 = b_copy.dump() self.assertEqual(o, o1)
def testCopy(self): b = BlockInfo(None, "/Foo", False, "") b.addUserParam("p0", "val0") b.addUserParam("p1", "val1") b2 = BlockInfo(None, "/Foo/bar", False, "") b2.addUserParam("p2", "val2") b2.addUserParam("p3", "val3") b3 = BlockInfo(None, "/Foo/bar1", False, "") b3.addUserParam("p4", "val4") b3.addUserParam("p5", "val5") b.addChildBlock(b2) b.addChildBlock(b3) b.setStarInfo(BlockInfo(None, "Foo/star", False, "")) b.addBlockType(BlockInfo(None, "Foo/t", False, "")) b_copy = b.copy(None) self.assertNotEqual(b_copy, b) self.assertEqual(b_copy.name, b.name) self.assertEqual(b_copy.types.keys(), b.types.keys()) self.assertNotEqual(b_copy.types, b.types) self.assertEqual(b_copy.children.keys(), b.children.keys()) self.assertEqual(b_copy.children_list, b.children_list) self.assertEqual(b_copy.parameters_list, b.parameters_list) self.assertEqual(b_copy.parameters.keys(), b.parameters.keys()) o = b.dump() o1 = b_copy.dump() self.assertEqual(o, o1)
def createTypes(self): b = BlockInfo(None, "Foo") b.addParameter(self.createParam("type")) b.addParameter(self.createParam("parent0")) b.addParameter(self.createParam("parent1")) b.addParameter(self.createParam("parent2")) for i in range(4): bt = BlockInfo(b, "type_%s" % i) b.addBlockType(bt) self.createParams(bt) return b
def createTypes(self): b = BlockInfo(None, "Foo") b.addParameter(self.createParam("type")) b.addParameter(self.createParam("parent0")) b.addParameter(self.createParam("parent1")) b.addParameter(self.createParam("parent2")) for i in range(4): bt = BlockInfo(b, "type_%s" % i) b.addBlockType(bt) self.createParams(bt) return b