CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes
Config.TestModuleCommand Class Reference
Inheritance diagram for Config.TestModuleCommand:

Public Member Functions

def setUp
 
def testCloneSequence
 
def testExamples
 
def testFreeze
 
def testGlobalReplace
 
def testImplicitSchedule
 
def testOverride
 
def testParameterizable
 
def testPath
 
def testPrefers
 
def testProcessDumpPython
 
def testProcessExtend
 
def testProcessInsertion
 
def testPrune
 
def testSchedule
 
def testSecSource
 
def testSequence
 
def testSequence2
 
def testSubProcess
 
def testTypedParameterizable
 
def testUsing
 

Static Public Attributes

tuple d = p.dumpPython()
 
tuple p = Process("test")
 
tuple s = Sequence(p.a)
 

Detailed Description

Definition at line 1076 of file Config.py.

Member Function Documentation

def Config.TestModuleCommand.setUp (   self)
Nothing to do 

Definition at line 1077 of file Config.py.

1078  def setUp(self):
1079  """Nothing to do """
None
def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 1372 of file Config.py.

1373  def testCloneSequence(self):
1374  p = Process("test")
1375  a = EDAnalyzer("MyAnalyzer")
1376  p.a = a
1377  a.setLabel("a")
1378  b = EDAnalyzer("YOurAnalyzer")
1379  p.b = b
1380  b.setLabel("b")
1381  path = Path(a * b)
1382  p.path = Path(p.a*p.b)
1383  lookuptable = {id(a): p.a, id(b): p.b}
1384  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
1385  #lookuptable = p._cloneToObjectDict
1386  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
1387  self.assertEqual(str(path),str(p.path))
def Config.TestModuleCommand.testExamples (   self)

Definition at line 1505 of file Config.py.

References Types.untracked.

1506  def testExamples(self):
1507  p = Process("Test")
1508  p.source = Source("PoolSource",fileNames = untracked(string("file:reco.root")))
1509  p.foos = EDProducer("FooProducer")
1510  p.bars = EDProducer("BarProducer", foos=InputTag("foos"))
1511  p.out = OutputModule("PoolOutputModule",fileName=untracked(string("file:foos.root")))
1512  p.bars.foos = 'Foosball'
1513  self.assertEqual(p.bars.foos, InputTag('Foosball'))
1514  p.p = Path(p.foos*p.bars)
1515  p.e = EndPath(p.out)
1516  p.add_(Service("MessageLogger"))
tuple untracked
Definition: Types.py:27
def Config.TestModuleCommand.testFreeze (   self)

Definition at line 1571 of file Config.py.

1572  def testFreeze(self):
1573  process = Process("Freeze")
1574  m = EDProducer("M", p=PSet(i = int32(1)))
1575  m.p.i = 2
1576  process.m = m
1577  # should be frozen
1578  #self.assertRaises(ValueError, setattr, m.p, 'i', 3)
1579  #self.assertRaises(ValueError, setattr, m, 'p', PSet(i=int32(1)))
1580  #self.assertRaises(ValueError, setattr, m.p, 'j', 1)
1581  #self.assertRaises(ValueError, setattr, m, 'j', 1)
1582  # But OK to change through the process
1583  process.m.p.i = 4
1584  self.assertEqual(process.m.p.i.value(), 4)
1585  process.m.p = PSet(j=int32(1))
1586  # should work to clone it, though
1587  m2 = m.clone(p = PSet(i = int32(5)), j = int32(8))
1588  m2.p.i = 6
m2.j = 8
def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 1315 of file Config.py.

1316  def testGlobalReplace(self):
1317  p = Process('test')
1318  p.a = EDAnalyzer("MyAnalyzer")
1319  p.b = EDAnalyzer("YourAnalyzer")
1320  p.c = EDAnalyzer("OurAnalyzer")
1321  p.s = Sequence(p.a*p.b)
1322  p.p = Path(p.c+p.s+p.a)
1323  new = EDAnalyzer("NewAnalyzer")
1324  p.globalReplace("a",new)
def Config.TestModuleCommand.testImplicitSchedule (   self)

Definition at line 1442 of file Config.py.

1443  def testImplicitSchedule(self):
1444  p = Process("test")
1445  p.a = EDAnalyzer("MyAnalyzer")
1446  p.b = EDAnalyzer("YourAnalyzer")
1447  p.c = EDAnalyzer("OurAnalyzer")
1448  p.path1 = Path(p.a)
1449  p.path2 = Path(p.b)
1450  self.assert_(p.schedule is None)
1451  pths = p.paths
1452  keys = pths.keys()
1453  self.assertEqual(pths[keys[0]],p.path1)
1454  self.assertEqual(pths[keys[1]],p.path2)
1455  p.prune()
1456  self.assert_(hasattr(p, 'a'))
1457  self.assert_(hasattr(p, 'b'))
1458  self.assert_(not hasattr(p, 'c'))
1459  self.assert_(hasattr(p, 'path1'))
1460  self.assert_(hasattr(p, 'path2'))
1461 
1462 
1463  p = Process("test")
1464  p.a = EDAnalyzer("MyAnalyzer")
1465  p.b = EDAnalyzer("YourAnalyzer")
1466  p.c = EDAnalyzer("OurAnalyzer")
1467  p.path2 = Path(p.b)
1468  p.path1 = Path(p.a)
1469  self.assert_(p.schedule is None)
1470  pths = p.paths
1471  keys = pths.keys()
1472  self.assertEqual(pths[keys[1]],p.path1)
1473  self.assertEqual(pths[keys[0]],p.path2)
1474 
def Config.TestModuleCommand.testOverride (   self)

Definition at line 1482 of file Config.py.

1483  def testOverride(self):
1484  p = Process('test')
1485  a = EDProducer("A", a1=int32(0))
1486  self.assert_(not a.isModified())
1487  a.a1 = 1
1488  self.assert_(a.isModified())
1489  p.a = a
1490  self.assertEqual(p.a.a1.value(), 1)
1491  # try adding an unmodified module.
1492  # should accept it
1493  p.a = EDProducer("A", a1=int32(2))
1494  self.assertEqual(p.a.a1.value(), 2)
1495  # try adding a modified module. Should throw
1496  # no longer, since the same (modified) say, geometry
1497  # could come from more than one cff
1498  b = EDProducer("A", a1=int32(3))
1499  b.a1 = 4
1500  #self.assertRaises(RuntimeError, setattr, *(p,'a',b))
1501  ps1 = PSet(a = int32(1))
1502  ps2 = PSet(a = int32(2))
1503  self.assertRaises(ValueError, EDProducer, 'C', ps1, ps2)
1504  self.assertRaises(ValueError, EDProducer, 'C', ps1, a=int32(3))
def Config.TestModuleCommand.testParameterizable (   self)

Definition at line 1080 of file Config.py.

1081  def testParameterizable(self):
1082  p = _Parameterizable()
1083  self.assertEqual(len(p.parameterNames_()),0)
1084  p.a = int32(1)
1085  self.assert_('a' in p.parameterNames_())
1086  self.assertEqual(p.a.value(), 1)
1087  p.a = 10
1088  self.assertEqual(p.a.value(), 10)
1089  p.a = untracked(int32(1))
1090  self.assertEqual(p.a.value(), 1)
1091  self.failIf(p.a.isTracked())
1092  p.a = untracked.int32(1)
1093  self.assertEqual(p.a.value(), 1)
1094  self.failIf(p.a.isTracked())
1095  p = _Parameterizable(foo=int32(10), bar = untracked(double(1.0)))
1096  self.assertEqual(p.foo.value(), 10)
1097  self.assertEqual(p.bar.value(),1.0)
1098  self.failIf(p.bar.isTracked())
1099  self.assertRaises(TypeError,setattr,(p,'c',1))
1100  p = _Parameterizable(a=PSet(foo=int32(10), bar = untracked(double(1.0))))
1101  self.assertEqual(p.a.foo.value(),10)
1102  self.assertEqual(p.a.bar.value(),1.0)
1103  p.b = untracked(PSet(fii = int32(1)))
1104  self.assertEqual(p.b.fii.value(),1)
1105  self.failIf(p.b.isTracked())
1106  #test the fact that values can be shared
1107  v = int32(10)
1108  p=_Parameterizable(a=v)
1109  v.setValue(11)
1110  self.assertEqual(p.a.value(),11)
1111  p.a = 12
1112  self.assertEqual(p.a.value(),12)
self.assertEqual(v.value(),12)
tuple untracked
Definition: Types.py:27
def Config.TestModuleCommand.testPath (   self)

Definition at line 1350 of file Config.py.

1351  def testPath(self):
1352  p = Process("test")
1353  p.a = EDAnalyzer("MyAnalyzer")
1354  p.b = EDAnalyzer("YourAnalyzer")
1355  p.c = EDAnalyzer("OurAnalyzer")
1356  path = Path(p.a)
1357  path *= p.b
1358  path += p.c
1359  self.assertEqual(str(path),'a+b+c')
1360  path = Path(p.a*p.b+p.c)
1361  self.assertEqual(str(path),'a+b+c')
1362 # path = Path(p.a)*p.b+p.c #This leads to problems with sequences
1363 # self.assertEqual(str(path),'((a*b)+c)')
1364  path = Path(p.a+ p.b*p.c)
1365  self.assertEqual(str(path),'a+b+c')
1366  path = Path(p.a*(p.b+p.c))
1367  self.assertEqual(str(path),'a+b+c')
1368  path = Path(p.a*(p.b+~p.c))
1369  self.assertEqual(str(path),'a+b+~c')
1370  p.es = ESProducer("AnESProducer")
1371  self.assertRaises(TypeError,Path,p.es)
def Config.TestModuleCommand.testPrefers (   self)

Definition at line 1517 of file Config.py.

1518  def testPrefers(self):
1519  p = Process("Test")
1520  p.add_(ESSource("ForceSource"))
1521  p.juicer = ESProducer("JuicerProducer")
1522  p.prefer("ForceSource")
1523  p.prefer("juicer")
1524  self.assertEqual(p.dumpConfig(),
1525 """process Test = {
1526  es_module juicer = JuicerProducer {
1527  }
1528  es_source = ForceSource {
1529  }
1530  es_prefer = ForceSource {
1531  }
1532  es_prefer juicer = JuicerProducer {
1533  }
1534 }
1535 """)
1536  p.prefer("juicer",fooRcd=vstring("Foo"))
1537  self.assertEqual(p.dumpConfig(),
1538 """process Test = {
1539  es_module juicer = JuicerProducer {
1540  }
1541  es_source = ForceSource {
1542  }
1543  es_prefer = ForceSource {
1544  }
1545  es_prefer juicer = JuicerProducer {
1546  vstring fooRcd = {
1547  'Foo'
1548  }
1549 
1550  }
1551 }
1552 """)
1553  self.assertEqual(p.dumpPython(),
1554 """import FWCore.ParameterSet.Config as cms
1555 
1556 process = cms.Process("Test")
1557 
1558 process.juicer = cms.ESProducer("JuicerProducer")
1559 
1560 
1561 process.ForceSource = cms.ESSource("ForceSource")
1562 
1563 
1564 process.prefer("ForceSource")
1565 
1566 process.prefer("juicer",
1567  fooRcd = cms.vstring('Foo')
1568 )
1569 
1570 """)
def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 1215 of file Config.py.

1216  def testProcessDumpPython(self):
1217  p = Process("test")
1218  p.a = EDAnalyzer("MyAnalyzer")
1219  p.p = Path(p.a)
1220  p.s = Sequence(p.a)
1221  p.r = Sequence(p.s)
1222  p.p2 = Path(p.s)
1223  p.schedule = Schedule(p.p2,p.p)
1224  d=p.dumpPython()
1225  self.assertEqual(d,
1226 """import FWCore.ParameterSet.Config as cms
1227 
1228 process = cms.Process("test")
1229 
1230 process.a = cms.EDAnalyzer("MyAnalyzer")
1231 
1232 
1233 process.s = cms.Sequence(process.a)
1234 
1235 
1236 process.r = cms.Sequence(process.s)
1237 
1238 
1239 process.p = cms.Path(process.a)
1240 
1241 
1242 process.p2 = cms.Path(process.s)
1243 
1244 
1245 process.schedule = cms.Schedule(*[ process.p2, process.p ])
1246 """)
1247  #Reverse order of 'r' and 's'
1248  p = Process("test")
1249  p.a = EDAnalyzer("MyAnalyzer")
1250  p.p = Path(p.a)
1251  p.r = Sequence(p.a)
1252  p.s = Sequence(p.r)
1253  p.p2 = Path(p.r)
1254  p.schedule = Schedule(p.p2,p.p)
1255  p.b = EDAnalyzer("YourAnalyzer")
1256  d=p.dumpPython()
1257  self.assertEqual(d,
1258 """import FWCore.ParameterSet.Config as cms
1259 
1260 process = cms.Process("test")
1261 
1262 process.a = cms.EDAnalyzer("MyAnalyzer")
1263 
1264 
1265 process.b = cms.EDAnalyzer("YourAnalyzer")
1266 
1267 
1268 process.r = cms.Sequence(process.a)
1269 
1270 
1271 process.s = cms.Sequence(process.r)
1272 
1273 
1274 process.p = cms.Path(process.a)
1275 
1276 
1277 process.p2 = cms.Path(process.r)
1278 
1279 
1280 process.schedule = cms.Schedule(*[ process.p2, process.p ])
""")
def Config.TestModuleCommand.testProcessExtend (   self)

Definition at line 1145 of file Config.py.

References python.multivaluedict.__init__(), and dbtoconf.object.

1146  def testProcessExtend(self):
1147  class FromArg(object):
1148  def __init__(self,*arg,**args):
1149  for name in args.iterkeys():
1150  self.__dict__[name]=args[name]
1151 
1152  a=EDAnalyzer("MyAnalyzer")
1153  t=EDAnalyzer("MyAnalyzer")
1154  t.setLabel("foo")
1155  s1 = Sequence(a)
1156  s2 = Sequence(s1)
1157  s3 = Sequence(s2)
1158  d = FromArg(
1159  a=a,
1160  b=Service("Full"),
1161  c=Path(a),
1162  d=s2,
1163  e=s1,
1164  f=s3,
1165  g=Sequence(s1+s2+s3)
1166  )
1167  p = Process("Test")
1168  p.extend(d)
1169  self.assertEqual(p.a.type_(),"MyAnalyzer")
1170  self.assertEqual(p.a.label_(),"a")
1171  self.assertRaises(AttributeError,getattr,p,'b')
1172  self.assertEqual(p.Full.type_(),"Full")
1173  self.assertEqual(str(p.c),'a')
1174  self.assertEqual(str(p.d),'a')
1175 
1176  z1 = FromArg(
1177  a=a,
1178  b=Service("Full"),
1179  c=Path(a),
1180  d=s2,
1181  e=s1,
1182  f=s3,
1183  s4=s3,
1184  g=Sequence(s1+s2+s3)
1185  )
1186 
1187  p1 = Process("Test")
1188  #p1.extend(z1)
1189  self.assertRaises(ValueError, p1.extend, z1)
1190 
1191  z2 = FromArg(
1192  a=a,
1193  b=Service("Full"),
1194  c=Path(a),
1195  d=s2,
1196  e=s1,
1197  f=s3,
1198  aaa=copy.deepcopy(a),
1199  s4=copy.deepcopy(s3),
1200  g=Sequence(s1+s2+s3),
1201  t=t
1202  )
1203  p2 = Process("Test")
1204  p2.extend(z2)
1205  #self.assertRaises(ValueError, p2.extend, z2)
1206  self.assertEqual(p2.s4.label_(),"s4")
1207  #p2.s4.setLabel("foo")
1208  self.assertRaises(ValueError, p2.s4.setLabel, "foo")
1209  p2.s4.setLabel("s4")
1210  p2.s4.setLabel(None)
1211  p2.s4.setLabel("foo")
1212  p2._Process__setObjectLabel(p2.s4, "foo")
1213  p2._Process__setObjectLabel(p2.s4, None)
1214  p2._Process__setObjectLabel(p2.s4, "bar")
list object
Definition: dbtoconf.py:77
def Config.TestModuleCommand.testProcessInsertion (   self)

Definition at line 1120 of file Config.py.

1121  def testProcessInsertion(self):
1122  p = Process("test")
1123  p.a = EDAnalyzer("MyAnalyzer")
1124  self.assert_( 'a' in p.analyzers_() )
1125  self.assert_( 'a' in p.analyzers)
1126  p.add_(Service("MessageLogger"))
1127  self.assert_('MessageLogger' in p.services_())
1128  self.assertEqual(p.MessageLogger.type_(), "MessageLogger")
1129  p.Tracer = Service("Tracer")
1130  self.assert_('Tracer' in p.services_())
1131  self.assertRaises(TypeError, setattr, *(p,'b',"this should fail"))
1132  self.assertRaises(TypeError, setattr, *(p,'bad',Service("MessageLogger")))
1133  self.assertRaises(ValueError, setattr, *(p,'bad',Source("PoolSource")))
1134  p.out = OutputModule("Outer")
1135  self.assertEqual(p.out.type_(), 'Outer')
1136  self.assert_( 'out' in p.outputModules_() )
1137 
1138  p.geom = ESSource("GeomProd")
1139  self.assert_('geom' in p.es_sources_())
1140  p.add_(ESSource("ConfigDB"))
1141  self.assert_('ConfigDB' in p.es_sources_())
1142 
1143  p.aliasfoo1 = EDAlias(foo1 = VPSet(PSet(type = string("Foo1"))))
1144  self.assert_('aliasfoo1' in p.aliases_())
def Config.TestModuleCommand.testPrune (   self)

Definition at line 1628 of file Config.py.

1629  def testPrune(self):
1630  p = Process("test")
1631  p.a = EDAnalyzer("MyAnalyzer")
1632  p.b = EDAnalyzer("YourAnalyzer")
1633  p.c = EDAnalyzer("OurAnalyzer")
1634  p.d = EDAnalyzer("OurAnalyzer")
1635  p.s = Sequence(p.d)
1636  p.path1 = Path(p.a)
1637  p.path2 = Path(p.b)
1638  self.assert_(p.schedule is None)
1639  pths = p.paths
1640  keys = pths.keys()
1641  self.assertEqual(pths[keys[0]],p.path1)
1642  self.assertEqual(pths[keys[1]],p.path2)
1643  p.pset1 = PSet(parA = string("pset1"))
1644  p.pset2 = untracked.PSet(parA = string("pset2"))
1645  p.vpset1 = VPSet()
1646  p.vpset2 = untracked.VPSet()
1647  p.prune()
1648  self.assert_(hasattr(p, 'a'))
1649  self.assert_(hasattr(p, 'b'))
1650  self.assert_(not hasattr(p, 'c'))
1651  self.assert_(not hasattr(p, 'd'))
1652  self.assert_(not hasattr(p, 's'))
1653  self.assert_(hasattr(p, 'path1'))
1654  self.assert_(hasattr(p, 'path2'))
1655  self.assert_(not hasattr(p, 'pset1'))
1656  self.assert_(hasattr(p, 'pset2'))
1657  self.assert_(not hasattr(p, 'vpset1'))
1658  self.assert_(not hasattr(p, 'vpset2'))
1659 
1660  p = Process("test")
1661  p.a = EDAnalyzer("MyAnalyzer")
1662  p.b = EDAnalyzer("YourAnalyzer")
1663  p.c = EDAnalyzer("OurAnalyzer")
1664  p.d = EDAnalyzer("OurAnalyzer")
1665  p.e = EDAnalyzer("OurAnalyzer")
1666  p.s = Sequence(p.d)
1667  p.s2 = Sequence(p.b)
1668  p.s3 = Sequence(p.e)
1669  p.path1 = Path(p.a)
1670  p.path2 = Path(p.b)
1671  p.path3 = Path(p.b+p.s2)
1672  p.path4 = Path(p.b+p.s3)
1673  p.schedule = Schedule(p.path1,p.path2,p.path3)
1674  pths = p.paths
1675  keys = pths.keys()
1676  self.assertEqual(pths[keys[0]],p.path1)
1677  self.assertEqual(pths[keys[1]],p.path2)
1678  p.prune()
1679  self.assert_(hasattr(p, 'a'))
1680  self.assert_(hasattr(p, 'b'))
1681  self.assert_(not hasattr(p, 'c'))
1682  self.assert_(not hasattr(p, 'd'))
1683  self.assert_(not hasattr(p, 'e'))
1684  self.assert_(not hasattr(p, 's'))
1685  self.assert_(hasattr(p, 's2'))
1686  self.assert_(not hasattr(p, 's3'))
1687  self.assert_(hasattr(p, 'path1'))
1688  self.assert_(hasattr(p, 'path2'))
1689  self.assert_(hasattr(p, 'path3'))
1690  self.assert_(not hasattr(p, 'path4'))
1691  #test SequencePlaceholder
1692  p = Process("test")
1693  p.a = EDAnalyzer("MyAnalyzer")
1694  p.b = EDAnalyzer("YourAnalyzer")
1695  p.s = Sequence(SequencePlaceholder("a")+p.b)
1696  p.pth = Path(p.s)
1697  p.prune()
1698  self.assert_(hasattr(p, 'a'))
1699  self.assert_(hasattr(p, 'b'))
1700  self.assert_(hasattr(p, 's'))
1701  self.assert_(hasattr(p, 'pth'))
1702 
unittest.main()
def Config.TestModuleCommand.testSchedule (   self)

Definition at line 1388 of file Config.py.

1389  def testSchedule(self):
1390  p = Process("test")
1391  p.a = EDAnalyzer("MyAnalyzer")
1392  p.b = EDAnalyzer("YourAnalyzer")
1393  p.c = EDAnalyzer("OurAnalyzer")
1394  p.d = EDAnalyzer("OurAnalyzer")
1395  p.path1 = Path(p.a)
1396  p.path2 = Path(p.b)
1397  p.path3 = Path(p.d)
1398 
1399  s = Schedule(p.path1,p.path2)
1400  self.assertEqual(s[0],p.path1)
1401  self.assertEqual(s[1],p.path2)
1402  p.schedule = s
1403  self.assert_('b' in p.schedule.moduleNames())
1404  self.assert_(hasattr(p, 'b'))
1405  self.assert_(hasattr(p, 'c'))
1406  self.assert_(hasattr(p, 'd'))
1407  self.assert_(hasattr(p, 'path1'))
1408  self.assert_(hasattr(p, 'path2'))
1409  self.assert_(hasattr(p, 'path3'))
1410  p.prune()
1411  self.assert_('b' in p.schedule.moduleNames())
1412  self.assert_(hasattr(p, 'b'))
1413  self.assert_(not hasattr(p, 'c'))
1414  self.assert_(not hasattr(p, 'd'))
1415  self.assert_(hasattr(p, 'path1'))
1416  self.assert_(hasattr(p, 'path2'))
1417  self.assert_(not hasattr(p, 'path3'))
1418 
1419  #adding a path not attached to the Process should cause an exception
1420  p = Process("test")
1421  p.a = EDAnalyzer("MyAnalyzer")
1422  path1 = Path(p.a)
1423  s = Schedule(path1)
1424  self.assertRaises(RuntimeError, lambda : p.setSchedule_(s) )
1425 
1426  #make sure anonymous sequences work
1427  p = Process("test")
1428  p.a = EDAnalyzer("MyAnalyzer")
1429  p.b = EDAnalyzer("MyOtherAnalyzer")
1430  p.c = EDProducer("MyProd")
1431  path1 = Path(p.c*Sequence(p.a+p.b))
1432  s = Schedule(path1)
1433  self.assert_('a' in s.moduleNames())
1434  self.assert_('b' in s.moduleNames())
1435  self.assert_('c' in s.moduleNames())
1436  p.path1 = path1
1437  p.schedule = s
1438  p.prune()
1439  self.assert_('a' in s.moduleNames())
1440  self.assert_('b' in s.moduleNames())
1441  self.assert_('c' in s.moduleNames())
def Config.TestModuleCommand.testSecSource (   self)

Definition at line 1310 of file Config.py.

References linker.replace().

1311  def testSecSource(self):
1312  p = Process('test')
1313  p.a = SecSource("MySecSource")
1314  self.assertEqual(p.dumpPython().replace('\n',''),'import FWCore.ParameterSet.Config as cmsprocess = cms.Process("test")process.a = cms.SecSource("MySecSource")')
def replace
Definition: linker.py:10
def Config.TestModuleCommand.testSequence (   self)

Definition at line 1325 of file Config.py.

1326  def testSequence(self):
1327  p = Process('test')
1328  p.a = EDAnalyzer("MyAnalyzer")
1329  p.b = EDAnalyzer("YourAnalyzer")
1330  p.c = EDAnalyzer("OurAnalyzer")
1331  p.s = Sequence(p.a*p.b)
1332  self.assertEqual(str(p.s),'a+b')
1333  self.assertEqual(p.s.label_(),'s')
1334  path = Path(p.c+p.s)
1335  self.assertEqual(str(path),'c+a+b')
1336  p._validateSequence(path, 'p1')
1337  notInProcess = EDAnalyzer('NotInProcess')
1338  p2 = Path(p.c+p.s*notInProcess)
1339  self.assertRaises(RuntimeError, p._validateSequence, p2, 'p2')
def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 1340 of file Config.py.

1341  def testSequence2(self):
1342  p = Process('test')
1343  p.a = EDAnalyzer("MyAnalyzer")
1344  p.b = EDAnalyzer("YourAnalyzer")
1345  p.c = EDAnalyzer("OurAnalyzer")
1346  testseq = Sequence(p.a*p.b)
1347  p.s = testseq
1348  #p.y = testseq
1349  self.assertRaises(ValueError, p.__setattr__, "y", testseq)
def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 1589 of file Config.py.

References cond.hash.

1590  def testSubProcess(self):
1591  process = Process("Parent")
1592  subProcess = Process("Child")
1593  subProcess.a = EDProducer("A")
1594  subProcess.p = Path(subProcess.a)
1595  subProcess.add_(Service("Foo"))
1596  process.add_( SubProcess(subProcess) )
1597  d = process.dumpPython()
1598  equalD ="""import FWCore.ParameterSet.Config as cms
1599 
1600 process = cms.Process("Parent")
1601 
1602 parentProcess = process
1603 import FWCore.ParameterSet.Config as cms
1604 
1605 process = cms.Process("Child")
1606 
1607 process.a = cms.EDProducer("A")
1608 
1609 
1610 process.p = cms.Path(process.a)
1611 
1612 
1613 process.Foo = cms.Service("Foo")
1614 
1615 
1616 childProcess = process
1617 process = parentProcess
1618 process.subProcess = cms.SubProcess( process = childProcess, SelectEvents = cms.untracked.PSet(
1619 
1620 ), outputCommands = cms.untracked.vstring())
1621 """
1622  equalD = equalD.replace("parentProcess","parentProcess"+str(hash(process.subProcess)))
1623  self.assertEqual(d,equalD)
1624  p = TestMakePSet()
1625  process.subProcess.insertInto(p,"dummy")
1626  self.assertEqual((True,['a']),p.values["@sub_process"][1].values["process"][1].values['@all_modules'])
1627  self.assertEqual((True,['p']),p.values["@sub_process"][1].values["process"][1].values['@paths'])
self.assertEqual({'@service_type':(True,'Foo')}, p.values["@sub_process"][1].values["process"][1].values["services"][1][0].values)
def Config.TestModuleCommand.testTypedParameterizable (   self)

Definition at line 1113 of file Config.py.

1114  def testTypedParameterizable(self):
1115  p = _TypedParameterizable("blah", b=int32(1))
1116  #see if copy works deeply
1117  other = p.copy()
1118  other.b = 2
1119  self.assertNotEqual(p.b,other.b)
def Config.TestModuleCommand.testUsing (   self)

Definition at line 1475 of file Config.py.

1476  def testUsing(self):
1477  p = Process('test')
1478  p.block = PSet(a = int32(1))
1479  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
1480  self.assertEqual(p.modu.a.value(),1)
1481  self.assertEqual(p.modu.b.value(),2)

Member Data Documentation

tuple Config.TestModuleCommand.d = p.dumpPython()
static

Definition at line 1289 of file Config.py.

tuple Config.TestModuleCommand.p = Process("test")
static

Definition at line 1282 of file Config.py.

tuple Config.TestModuleCommand.s = Sequence(p.a)
static

Definition at line 1285 of file Config.py.