842 def _isValid(self,value):
847 _ParameterTypeBase.__init__(self)
848 _Parameterizable.__init__(self,*arg,**args)
850 return "__PSet(\n"+_Parameterizable.dumpPython(self, options)+options.indentation()+
")"
856 x = __PSet(a = __TestType(4),
858 c = __PSet(gamma = __TestType(5))))
865 c = a.clone(x = dict(a=
None, c=
None))
866 self.assertEqual(a.t.value(),1)
867 self.assertEqual(a.u.value(),2)
868 self.assertEqual(b.t.value(),3)
869 self.assertEqual(b.u.value(),2)
870 self.assertEqual(b.v.value(),4)
871 self.assertEqual(b.x.a.value(),7)
872 self.assertEqual(b.x.b.value(),6)
873 self.assertEqual(b.x.c.gamma.value(),8)
874 self.assertEqual(b.x.d.value(),9)
875 self.assertEqual(hasattr(b,
"w"),
False)
876 self.assertEqual(hasattr(c.x,
"a"),
False)
877 self.assertEqual(hasattr(c.x,
"c"),
False)
878 self.assertRaises(TypeError,a.clone,**{
"v":1})
879 d = a.clone(__PSet(k=__TestType(42)))
880 self.assertEqual(d.t.value(), 1)
881 self.assertEqual(d.k.value(), 42)
882 d2 = a.clone(__PSet(t=__TestType(42)))
883 self.assertEqual(d2.t.value(), 42)
884 d3 = a.clone(__PSet(t=__TestType(42)),
885 __PSet(u=__TestType(56)))
886 self.assertEqual(d3.t.value(), 42)
887 self.assertEqual(d3.u.value(), 56)
888 self.assertRaises(ValueError,a.clone,
889 __PSet(t=__TestType(42)),
890 __PSet(t=__TestType(56)))
891 d4 = a.clone(__PSet(t=__TestType(43)), u = 57)
892 self.assertEqual(d4.t.value(), 43)
893 self.assertEqual(d4.u.value(), 57)
894 self.assertRaises(TypeError,a.clone,t=__TestType(43),**{
"doesNotExist":57})
897 self.assertEqual(len(e.parameterNames_()), 0)
898 f = e.clone(__PSet(a = __TestType(1)), b = __TestType(2))
899 self.assertEqual(f.a.value(), 1)
900 self.assertEqual(f.b.value(), 2)
902 self.assertEqual(len(g.parameterNames_()), 0)