From 2f66ff830c49d2cf611a40304be9a6ae0d04a117 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 14 Jul 2021 03:23:34 +0200 Subject: [PATCH] Fix unit tests python 3 Changes in Config.py are only reordering things --- FWCore/ParameterSet/python/Config.py | 28 ++--- FWCore/ParameterSet/python/DictTypes.py | 4 +- FWCore/ParameterSet/python/Mixins.py | 4 +- FWCore/ParameterSet/python/SequenceTypes.py | 31 +++--- FWCore/ParameterSet/python/Types.py | 113 ++++++++++---------- 5 files changed, 90 insertions(+), 90 deletions(-) diff --git a/FWCore/ParameterSet/python/Config.py b/FWCore/ParameterSet/python/Config.py index 22c7d7f463939..c8ef6e9015a41 100644 --- a/FWCore/ParameterSet/python/Config.py +++ b/FWCore/ParameterSet/python/Config.py @@ -2431,13 +2431,13 @@ def testTask(self): # Also note that the mutating visitor replaces sequences and tasks that have # modified contents with their modified contents, it does not modify the sequence # or task itself. - self.assertTrue(process.path21.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n') + self.assertTrue(process.path21.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n') process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter]) - self.assertTrue(process.path22.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.messource, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n') + self.assertTrue(process.path22.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.messource, process.mproducer10, process.mproducer2, process.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n') process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10]) - self.assertTrue(process.path23.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None), cms.Task(process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n') + self.assertTrue(process.path23.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None), cms.Task(process.mproducer2, process.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n') process.a = EDAnalyzer("MyAnalyzer") process.b = OutputModule("MyOutputModule") @@ -3116,14 +3116,14 @@ def testTaskPlaceholder(self): process.i = cms.EDProducer("mi") process.j = cms.EDProducer("mj") process.b = cms.EDAnalyzer("mb") -process.t8 = cms.Task(cms.TaskPlaceholder("j")) -process.t6 = cms.Task(cms.TaskPlaceholder("h")) -process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6) -process.t4 = cms.Task(cms.TaskPlaceholder("f")) -process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a) -process.t3 = cms.Task(cms.TaskPlaceholder("e")) process.t1 = cms.Task(cms.TaskPlaceholder("c")) process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1) +process.t3 = cms.Task(cms.TaskPlaceholder("e")) +process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a) +process.t4 = cms.Task(cms.TaskPlaceholder("f")) +process.t6 = cms.Task(cms.TaskPlaceholder("h")) +process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6) +process.t8 = cms.Task(cms.TaskPlaceholder("j")) process.path1 = cms.Path(process.b, process.t2, process.t3) process.endpath1 = cms.EndPath(process.b, process.t5) process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""") @@ -3139,14 +3139,14 @@ def testTaskPlaceholder(self): process.i = cms.EDProducer("mi") process.j = cms.EDProducer("mj") process.b = cms.EDAnalyzer("mb") -process.t8 = cms.Task(process.j) +process.t1 = cms.Task(process.c) +process.t2 = cms.Task(process.a, process.d, process.t1) +process.t3 = cms.Task(process.e) +process.t4 = cms.Task(process.f) process.t6 = cms.Task(process.h) process.t7 = cms.Task(process.a, process.i, process.t6) -process.t4 = cms.Task(process.f) +process.t8 = cms.Task(process.j) process.t5 = cms.Task(process.a, process.g, process.t4) -process.t3 = cms.Task(process.e) -process.t1 = cms.Task(process.c) -process.t2 = cms.Task(process.a, process.d, process.t1) process.path1 = cms.Path(process.b, process.t2, process.t3) process.endpath1 = cms.EndPath(process.b, process.t5) process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""") diff --git a/FWCore/ParameterSet/python/DictTypes.py b/FWCore/ParameterSet/python/DictTypes.py index 189b474f9eaec..755a946e39699 100644 --- a/FWCore/ParameterSet/python/DictTypes.py +++ b/FWCore/ParameterSet/python/DictTypes.py @@ -7,7 +7,7 @@ def __init__(self,*args,**kw): dict.__init__(self,*args,**kw) self.list = list() if len(args) == 1: - if not hasattr(args[0],'iterkeys'): + if not hasattr(args[0],'keys'): s = set() #must protect against adding the same key multiple times for x,y in iter(args[0]): @@ -15,7 +15,7 @@ def __init__(self,*args,**kw): self.list.append(x) s.add(x) else: - self.list = list(args[0].iterkeys()) + self.list = list(args[0].keys()) return self.list = list(six.iterkeys(super(SortedKeysDict,self))) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index 6d300b885ae5a..4cba92a528daf 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -800,7 +800,7 @@ def __init__(self): self.assertEqual(t,pythonized) def testUsingBlock(self): a = UsingBlock("a") - self.assert_(isinstance(a, _ParameterTypeBase)) + self.assertTrue(isinstance(a, _ParameterTypeBase)) def testConstruction(self): class __Test(_TypedParameterizable): pass @@ -929,7 +929,7 @@ def __init__(self): def testSpecialImportRegistry(self): reg = _SpecialImportRegistry() reg.registerSpecialImportForType(int, "import foo") - self.assertRaises(lambda x: reg.registerSpecialImportForType(int, "import bar")) + self.assertRaises(RuntimeError, lambda: reg.registerSpecialImportForType(int, "import bar")) reg.registerSpecialImportForType(str, "import bar") self.assertEqual(reg.getSpecialImports(), []) reg.registerUse([1]) diff --git a/FWCore/ParameterSet/python/SequenceTypes.py b/FWCore/ParameterSet/python/SequenceTypes.py index e762d46a3dcea..c7bb4e0eaaf5e 100644 --- a/FWCore/ParameterSet/python/SequenceTypes.py +++ b/FWCore/ParameterSet/python/SequenceTypes.py @@ -200,11 +200,12 @@ def _replaceIfHeldDirectly(self,original,replacement): if original == i: self._collection[self._collection.index(original)] = replacement didReplace = True - elif isinstance(i,_UnarySequenceOperator): - if i._replace(original, replacement): - didReplace = True - if replacement is None: - self._collection[self._collection.index(i)] = None + elif isinstance(i,_UnarySequenceOperator) and i._has(original): + didReplace = True + if replacement is None: + self._collection[self._collection.index(i)] = None + else: + self._collection[self._collection.index(i)] = type(i)(replacement) if replacement is None: self._collection = [ i for i in self._collection if i is not None] return didReplace @@ -545,26 +546,20 @@ def __init__(self, operand): raise RuntimeError("This operator cannot accept a non sequenceable type") def __eq__(self, other): # allows replace(~a, b) - return isinstance(self, type(other)) and self._operand==other._operand + return type(self) is type(other) and self._operand==other._operand def __ne__(self, other): return not self.__eq__(other) + def __hash__(self): + # this definition implies that self._operand MUST NOT be changed after the construction + return hash((type(self), self._operand)) def _findDependencies(self,knownDeps, presentDeps): self._operand._findDependencies(knownDeps, presentDeps) def _clonesequence(self, lookuptable): return type(self)(self._operand._clonesequence(lookuptable)) - def _replace(self, original, replacement): - if self._operand == original: - self._operand = replacement - return True - return False - def _remove(self, original): - if (self._operand == original): return (None, True) - (self._operand, found) = self._operand._remove(original) - if self._operand == None: return (None, True) - return (self, found) + def _has(self, op): + return self._operand == op def resolve(self, processDict,keepIfCannotResolve=False): - self._operand = self._operand.resolve(processDict,keepIfCannotResolve) - return self + return type(self)(self._operand.resolve(processDict,keepIfCannotResolve)) def isOperation(self): return True def _visitSubNodes(self,visitor): diff --git a/FWCore/ParameterSet/python/Types.py b/FWCore/ParameterSet/python/Types.py index 3024376a009b4..aac406dda2bce 100644 --- a/FWCore/ParameterSet/python/Types.py +++ b/FWCore/ParameterSet/python/Types.py @@ -213,6 +213,8 @@ def insertInto(self, parameterSet, myname): parameterSet.addInt32(self.isTracked(), myname, self.value()) def __nonzero__(self): return self.value()!=0 + def __bool__(self): + return self.__nonzero__() class uint32(_SimpleParameterTypeBase): @@ -230,6 +232,8 @@ def insertInto(self, parameterSet, myname): parameterSet.addUInt32(self.isTracked(), myname, self.value()) def __nonzero__(self): return self.value()!=0 + def __bool__(self): + return self.__nonzero__() @@ -360,6 +364,8 @@ def insertInto(self, parameterSet, myname): parameterSet.addString(self.isTracked(), myname, value) def __nonzero__(self): return len(self.value()) !=0 + def __bool__(self): + return self.__nonzero__() class EventID(_ParameterTypeBase): @@ -1486,19 +1492,19 @@ class testTypes(unittest.TestCase): def testint32(self): i = int32(1) self.assertEqual(i.value(),1) - self.assert_(i) + self.assertTrue(i) self.assertRaises(ValueError,int32,"i") i = int32._valueFromString("0xA") self.assertEqual(i.value(),10) - self.assert_(not int32(0)) + self.assertTrue(not int32(0)) def testuint32(self): i = uint32(1) self.assertEqual(i.value(),1) - self.assert_(i) + self.assertTrue(i) i = uint32(0) self.assertEqual(i.value(),0) - self.assert_(not i) + self.assertTrue(not i) self.assertRaises(ValueError,uint32,"i") self.assertRaises(ValueError,uint32,-1) i = uint32._valueFromString("0xA") @@ -1515,7 +1521,7 @@ def testdouble(self): self.assertEqual(d,-float('Inf')) self.assertEqual(d.pythonValue(),"-float('inf')") d = double(float('Nan')) - self.assert_(math.isnan(d.value())) + self.assertTrue(math.isnan(d.value())) self.assertEqual(d.pythonValue(),"float('nan')") def testvdouble(self): d = vdouble(1) @@ -1528,16 +1534,16 @@ def testvdouble(self): self.assertEqual(d,[-float('inf')]) self.assertEqual(d.dumpPython(),"cms.vdouble(-float('inf'))") d = vdouble(float('nan')) - self.assert_(math.isnan(d[0])) + self.assertTrue(math.isnan(d[0])) self.assertEqual(d.dumpPython(),"cms.vdouble(float('nan'))") def testvint32(self): v = vint32() self.assertEqual(len(v),0) - self.assert_(not v) + self.assertTrue(not v) v.append(1) self.assertEqual(len(v),1) self.assertEqual(v[0],1) - self.assert_(v) + self.assertTrue(v) v.append(2) v.insert(1,3) self.assertEqual(v[1],3) @@ -1551,10 +1557,10 @@ def testvint32(self): def testbool(self): b = bool(True) self.assertEqual(b.value(),True) - self.assert_(b) + self.assertTrue(b) b = bool(False) self.assertEqual(b.value(),False) - self.assert_(not b) + self.assertTrue(not b) b = bool._valueFromString("2") self.assertEqual(b.value(),True) self.assertEqual(repr(b), "cms.bool(True)") @@ -1563,13 +1569,13 @@ def testString(self): s=string('this is a test') self.assertEqual(s.value(),'this is a test') self.assertEqual(repr(s), "cms.string(\'this is a test\')") - self.assert_(s) + self.assertTrue(s) s=string('\0') self.assertEqual(s.value(),'\0') self.assertEqual(s.configValue(),"'\\0'") s2=string('') self.assertEqual(s2.value(),'') - self.assert_(not s2) + self.assertTrue(not s2) def testvstring(self): a = vstring("", "Barack", "John", "Sarah", "Joe") self.assertEqual(len(a), 5) @@ -1580,16 +1586,16 @@ def testvstring(self): def testUntracked(self): p=untracked(int32(1)) self.assertRaises(TypeError,untracked,(1),{}) - self.failIf(p.isTracked()) + self.assertFalse(p.isTracked()) p=untracked.int32(1) self.assertEqual(repr(p), "cms.untracked.int32(1)") self.assertRaises(TypeError,untracked,(1),{}) - self.failIf(p.isTracked()) + self.assertFalse(p.isTracked()) p=untracked.vint32(1,5,3) self.assertRaises(TypeError,untracked,(1,5,3),{}) - self.failIf(p.isTracked()) + self.assertFalse(p.isTracked()) p = untracked.PSet(b=int32(1)) - self.failIf(p.isTracked()) + self.assertFalse(p.isTracked()) self.assertEqual(p.b.value(),1) def testInputTag(self): it = InputTag._valueFromString("label::proc") @@ -1823,19 +1829,19 @@ def testPSet(self): vp1 = VPSet(PSet(i = int32(2))) #self.assertEqual(vp1.configValue(), " self.assertEqual(repr(vp1), "cms.VPSet(cms.PSet(\n i = cms.int32(2)\n))") - self.assert_(p1.hasParameter(['a', 'b'])) - self.failIf(p1.hasParameter(['a', 'c'])) + self.assertTrue(p1.hasParameter(['a', 'b'])) + self.assertFalse(p1.hasParameter(['a', 'c'])) self.assertEqual(p1.getParameter(['a', 'b']).value(), 1) # test clones and trackedness p3 = untracked.PSet(i = int32(1), ui=untracked.int32(2), a = PSet(b = untracked.int32(1)), b = untracked.PSet(b = int32(1))) p4 = p3.clone() self.assertFalse(p4.isTracked()) - self.assert_(p4.i.isTracked()) + self.assertTrue(p4.i.isTracked()) self.assertFalse(p4.ui.isTracked()) - self.assert_(p4.a.isTracked()) + self.assertTrue(p4.a.isTracked()) self.assertFalse(p4.b.isTracked()) self.assertFalse(p4.a.b.isTracked()) - self.assert_(p4.b.b.isTracked()) + self.assertTrue(p4.b.b.isTracked()) p4 = p3.clone( i = None, b = dict(b = 5)) self.assertEqual(p3.i.value(), 1) self.assertEqual(hasattr(p4,"i"), False) @@ -1858,7 +1864,7 @@ def testPSet(self): self.assertRaises(TypeError, p5.p , dict(bar = 3) ) def testRequired(self): p1 = PSet(anInt = required.int32) - self.assert_(hasattr(p1,"anInt")) + self.assertTrue(hasattr(p1,"anInt")) self.assertEqual(p1.dumpPython(),'cms.PSet(\n anInt = cms.required.int32\n)') p1.anInt = 3 self.assertEqual(p1.dumpPython(),'cms.PSet(\n anInt = cms.int32(3)\n)') @@ -1871,24 +1877,24 @@ def testRequired(self): p1 = PSet(anInt = required.untracked.int32) p1.anInt = 5 self.assertEqual(p1.anInt.value(), 5) - self.failIf(p1.anInt.isTracked()) + self.assertFalse(p1.anInt.isTracked()) p1 = PSet(anInt = required.untracked.int32) self.assertEqual(p1.dumpPython(), 'cms.PSet(\n anInt = cms.required.untracked.int32\n)') p1.anInt = 6 self.assertEqual(p1.dumpPython(), 'cms.PSet(\n anInt = cms.untracked.int32(6)\n)') - self.assert_(p1.anInt.isCompatibleCMSType(int32)) - self.failIf(p1.anInt.isCompatibleCMSType(uint32)) + self.assertTrue(p1.anInt.isCompatibleCMSType(int32)) + self.assertFalse(p1.anInt.isCompatibleCMSType(uint32)) p1 = PSet(allowAnyLabel_ = required.int32) - self.failIf(p1.hasParameter(['allowAnyLabel_'])) + self.assertFalse(p1.hasParameter(['allowAnyLabel_'])) p1.foo = 3 self.assertEqual(p1.foo.value(),3) self.assertRaises(ValueError,setattr,p1, 'bar', 'bad') - self.assert_(p1.foo.isTracked()) + self.assertTrue(p1.foo.isTracked()) p1 = PSet(allowAnyLabel_ = required.untracked.int32) - self.failIf(p1.hasParameter(['allowAnyLabel_'])) + self.assertFalse(p1.hasParameter(['allowAnyLabel_'])) p1.foo = 3 self.assertEqual(p1.foo.value(),3) - self.failIf(p1.foo.isTracked()) + self.assertFalse(p1.foo.isTracked()) self.assertRaises(ValueError,setattr,p1, 'bar', 'bad') #PSetTemplate use p1 = PSet(aPSet = required.PSetTemplate()) @@ -1917,7 +1923,7 @@ def testRequired(self): def testOptional(self): p1 = PSet(anInt = optional.int32) - self.assert_(hasattr(p1,"anInt")) + self.assertTrue(hasattr(p1,"anInt")) self.assertEqual(p1.dumpPython(),'cms.PSet(\n anInt = cms.optional.int32\n)') p1.anInt = 3 self.assertEqual(p1.anInt.value(), 3) @@ -1930,19 +1936,19 @@ def testOptional(self): p1 = PSet(anInt = optional.untracked.int32) p1.anInt = 5 self.assertEqual(p1.anInt.value(), 5) - self.failIf(p1.anInt.isTracked()) + self.assertFalse(p1.anInt.isTracked()) p1 = PSet(anInt = optional.untracked.int32) self.assertEqual(p1.dumpPython(), 'cms.PSet(\n anInt = cms.optional.untracked.int32\n)') p1.anInt = 6 self.assertEqual(p1.dumpPython(), 'cms.PSet(\n anInt = cms.untracked.int32(6)\n)') - self.assert_(p1.anInt.isCompatibleCMSType(int32)) - self.failIf(p1.anInt.isCompatibleCMSType(uint32)) + self.assertTrue(p1.anInt.isCompatibleCMSType(int32)) + self.assertFalse(p1.anInt.isCompatibleCMSType(uint32)) p1 = PSet(f = required.vint32) - self.failIf(p1.f) + self.assertFalse(p1.f) p1.f = [] - self.failIf(p1.f) + self.assertFalse(p1.f) p1.f.append(3) - self.assert_(p1.f) + self.assertTrue(p1.f) #PSetTemplate use p1 = PSet(aPSet = optional.PSetTemplate()) self.assertEqual(p1.dumpPython(),'cms.PSet(\n aPSet = cms.optional.PSetTemplate(\n\n )\n)') @@ -1972,21 +1978,21 @@ def testAllowed(self): self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.required.allowed(cms.int32,cms.string)\n)') p1.aValue = 1 self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.int32(1)\n)') - self.assert_(p1.aValue.isCompatibleCMSType(int32)) - self.failIf(p1.aValue.isCompatibleCMSType(uint32)) - self.assertRaises(ValueError,setattr(p1,'aValue',PSet())) + self.assertTrue(p1.aValue.isCompatibleCMSType(int32)) + self.assertFalse(p1.aValue.isCompatibleCMSType(uint32)) + self.assertRaises(RuntimeError, lambda: setattr(p1,'aValue',1.3)) p1 = PSet(aValue = required.allowed(int32, string)) self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.required.allowed(cms.int32,cms.string)\n)') p1.aValue = "foo" self.assertEqual(p1.dumpPython(),"cms.PSet(\n aValue = cms.string('foo')\n)") - self.assert_(p1.aValue.isCompatibleCMSType(string)) - self.failIf(p1.aValue.isCompatibleCMSType(uint32)) + self.assertTrue(p1.aValue.isCompatibleCMSType(string)) + self.assertFalse(p1.aValue.isCompatibleCMSType(uint32)) p1 = PSet(aValue = required.untracked.allowed(int32, string)) self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.required.untracked.allowed(cms.int32,cms.string)\n)') p1.aValue = 1 self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.untracked.int32(1)\n)') - self.assertRaises(ValueError,setattr(p1,'aValue',PSet())) + self.assertRaises(RuntimeError, lambda: setattr(p1,'aValue',1.3)) p1 = PSet(aValue = required.untracked.allowed(int32, string)) self.assertEqual(p1.dumpPython(),'cms.PSet(\n aValue = cms.required.untracked.allowed(cms.int32,cms.string)\n)') p1.aValue = "foo" @@ -2042,10 +2048,10 @@ def testVPSet(self): self.assertRaises(SyntaxError, lambda : VPSet(foo=PSet())) def testEDAlias(self): aliasfoo2 = EDAlias(foo2 = VPSet(PSet(type = string("Foo2")))) - self.assert_(hasattr(aliasfoo2,"foo2")) + self.assertTrue(hasattr(aliasfoo2,"foo2")) del aliasfoo2.foo2 - self.assert_(not hasattr(aliasfoo2,"foo2")) - self.assert_("foo2" not in aliasfoo2.parameterNames_()) + self.assertTrue(not hasattr(aliasfoo2,"foo2")) + self.assertTrue("foo2" not in aliasfoo2.parameterNames_()) aliasfoo2 = EDAlias(foo2 = VPSet(PSet(type = string("Foo2")))) aliasfoo3 = aliasfoo2.clone( @@ -2189,18 +2195,18 @@ def testPSetConversion(self): ) convert = _ConvertToPSet() p.insertInto(convert,"p") - self.assert_(hasattr(convert.pset,'p')) - self.assert_(hasattr(convert.pset.p,'a')) + self.assertTrue(hasattr(convert.pset,'p')) + self.assertTrue(hasattr(convert.pset.p,'a')) self.assertEqual(p.a,convert.pset.p.a) self.assertEqual(p.a.isTracked(),convert.pset.p.a.isTracked()) q = PSet(b = int32(1), p = p) q.insertInto(convert,"q") - self.assert_(hasattr(convert.pset,'q')) - self.assert_(hasattr(convert.pset.q,'b')) + self.assertTrue(hasattr(convert.pset,'q')) + self.assertTrue(hasattr(convert.pset.q,'b')) self.assertEqual(q.b,convert.pset.q.b) - self.assert_(hasattr(convert.pset.q,'p')) - self.assert_(hasattr(convert.pset.q.p,'a')) + self.assertTrue(hasattr(convert.pset.q,'p')) + self.assertTrue(hasattr(convert.pset.q.p,'a')) self.assertEqual(p.a,convert.pset.q.p.a) for i in p.parameterNames_(): self.assertEqual(str(getattr(p,i)),str(getattr(convert.pset.p,i))) @@ -2210,8 +2216,8 @@ def testVPSetConversion(self): v = VPSet(p,q) convert = _ConvertToPSet() v.insertInto(convert,'v') - self.assert_(hasattr(convert.pset,'v')) - self.assert_(len(convert.pset.v)==2) + self.assertTrue(hasattr(convert.pset,'v')) + self.assertTrue(len(convert.pset.v)==2) self.assertEqual(v[0].a,convert.pset.v[0].a) self.assertEqual(v[1].b,convert.pset.v[1].b) self.assertEqual(v[1].p.a, convert.pset.v[1].p.a) @@ -2233,7 +2239,6 @@ def testnumbers(self): def teststring(self): self.assertGreater(string("I am a string"), "I am a strinf") self.assertGreaterEqual("I am a string", string("I am a string")) - self.assertLess(5, string("I am a string")) def testincompatibletypes(self): import sys if sys.version_info < (3, 0): #python 2, comparing incompatible types compares the class name