847 class __Test(_TypedParameterizable):
849 class __TestType(_SimpleParameterTypeBase):
850 def _isValid(self,value):
852 class __PSet(_ParameterTypeBase,_Parameterizable):
855 _ParameterTypeBase.__init__(self)
856 _Parameterizable.__init__(self,*arg,**args)
858 return "__PSet(\n"+_Parameterizable.dumpPython(self, options)+options.indentation()+
")" 864 x = __PSet(a = __TestType(4),
866 c = __PSet(gamma = __TestType(5))))
873 c = a.clone(x = dict(a=
None, c=
None))
874 self.assertEqual(a.t.value(),1)
875 self.assertEqual(a.u.value(),2)
876 self.assertEqual(b.t.value(),3)
877 self.assertEqual(b.u.value(),2)
878 self.assertEqual(b.v.value(),4)
879 self.assertEqual(b.x.a.value(),7)
880 self.assertEqual(b.x.b.value(),6)
881 self.assertEqual(b.x.c.gamma.value(),8)
882 self.assertEqual(b.x.d.value(),9)
883 self.assertEqual(hasattr(b,
"w"),
False)
884 self.assertEqual(hasattr(c.x,
"a"),
False)
885 self.assertEqual(hasattr(c.x,
"c"),
False)
886 self.assertRaises(TypeError,a.clone,**{
"v":1})
887 d = a.clone(__PSet(k=__TestType(42)))
888 self.assertEqual(d.t.value(), 1)
889 self.assertEqual(d.k.value(), 42)
890 d2 = a.clone(__PSet(t=__TestType(42)))
891 self.assertEqual(d2.t.value(), 42)
892 d3 = a.clone(__PSet(t=__TestType(42)),
893 __PSet(u=__TestType(56)))
894 self.assertEqual(d3.t.value(), 42)
895 self.assertEqual(d3.u.value(), 56)
896 self.assertRaises(ValueError,a.clone,
897 __PSet(t=__TestType(42)),
898 __PSet(t=__TestType(56)))
899 d4 = a.clone(__PSet(t=__TestType(43)), u = 57)
900 self.assertEqual(d4.t.value(), 43)
901 self.assertEqual(d4.u.value(), 57)
902 self.assertRaises(TypeError,a.clone,t=__TestType(43),**{
"doesNotExist":57})
905 self.assertEqual(len(e.parameterNames_()), 0)
906 f = e.clone(__PSet(a = __TestType(1)), b = __TestType(2))
907 self.assertEqual(f.a.value(), 1)
908 self.assertEqual(f.b.value(), 2)
910 self.assertEqual(len(g.parameterNames_()), 0)
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
def dumpPython(process, name)