1977 m1.toModify(p.a,_mod_fred)
1978 self.assertEqual(p.a.fred.value(),2)
1980 m1.toModify(p.b, wilma = 2)
1981 self.assertEqual(p.b.wilma.value(),2)
1986 m1.toModify(p.a,_mod_fred)
1988 m1.toModify(p.b, wilma = 2)
1989 self.assertEqual(p.a.fred.value(),1)
1990 self.assertEqual(p.b.wilma.value(),1)
1995 m1.toModify(p.a, fred =
int32(2))
1996 p.b = p.a.clone(wilma =
int32(3))
1997 self.assertEqual(p.a.fred.value(),2)
1998 self.assertEqual(p.a.wilma.value(),1)
1999 self.assertEqual(p.b.fred.value(),2)
2000 self.assertEqual(p.b.wilma.value(),3)
2005 m1.toModify(p.a, fred =
None)
2006 self.assertEqual(hasattr(p.a,
"fred"),
False)
2007 self.assertEqual(p.a.wilma.value(),1)
2012 m1.toModify(p.a, wilma =
int32(2))
2013 self.assertEqual(p.a.fred.value(), 1)
2014 self.assertEqual(p.a.wilma.value(),2)
2019 m1.toModify(p.a, flintstones =
dict(fred =
int32(2)))
2020 self.assertEqual(p.a.flintstones.fred.value(),2)
2021 self.assertEqual(p.a.flintstones.wilma.value(),1)
2025 class ProcModifierMod(object):
2026 def __init__(self,modifier,func):
2027 self.
proc_mod_ = modifier.makeProcessModifier(func)
2028 class DummyMod(object):
2031 testMod = DummyMod()
2033 self.assert_(hasattr(p,
"a"))
2036 testProcMod = ProcModifierMod(m1,_rem_a)
2038 p.extend(testProcMod)
2039 self.assert_(
not hasattr(p,
"a"))
2044 testMod = DummyMod()
2046 m1.toModify(p.b, fred =
int32(3))
2048 testProcMod = ProcModifierMod(m1,_rem_a)
2049 p.extend(testProcMod)
2050 self.assert_(
not hasattr(p,
"a"))
2051 self.assertEqual(p.b.fred.value(),3)
2057 (m1 & m2).toModify(p.a, fred =
int32(2))
2058 self.assertEqual(p.a.fred, 1)
2063 (m1 & m2).toModify(p.a, fred =
int32(2))
2064 self.assertEqual(p.a.fred, 2)
2070 (m1 & m2 & m3).toModify(p.a, fred =
int32(2))
2071 self.assertEqual(p.a.fred, 2)
2079 m1.toReplaceWith(p.s,
Sequence(p.a+p.b))
2080 self.assertEqual(p.a.wilma.value(),3)
2081 self.assertEqual(p.a.type_(),
"YourAnalyzer")
2082 self.assertEqual(hasattr(p,
"fred"),
False)
2083 self.assertEqual(p.s.dumpPython(
""),
"cms.Sequence(process.a+process.b)\n")
2089 self.assertEqual(p.a.type_(),
"MyAnalyzer")
unittest.main()