H
HMS Surprise
Snippet 1 below doesn't do much but works (more code is inserted by a
generator). In the next to last line the class name is also used as
argument. I have seen this construct before and have had error
messages tell me that the name is expected. Why is this so? In snippet
2 that I concocted is not required. Is it related to __init__ perhaps?
Thanks,
jvh
# Snippet 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from PyHttpTestCase import PyHttpTestCase
# definition of test class
class MaxQTest(PyHttpTestCase):
def runTest(self):
self.msg('Test started')
# ^^^ Insert new recordings here. (Do not remove this line.)
# Code to load and run the test
if __name__ == 'main':
test = MaxQTest("MaxQTest")
test.Run()
# Snippet 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class topClass():
str = 'abc'
def tcMsg(self):
print 'topClass tcMsg'
class one(topClass):
strOne = 'class one'
def classOneFun(self):
print 'this is classOneFun'
self.tcMsg()
if __name__ == 'main':
test = one()
test.classOneFun()
generator). In the next to last line the class name is also used as
argument. I have seen this construct before and have had error
messages tell me that the name is expected. Why is this so? In snippet
2 that I concocted is not required. Is it related to __init__ perhaps?
Thanks,
jvh
# Snippet 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from PyHttpTestCase import PyHttpTestCase
# definition of test class
class MaxQTest(PyHttpTestCase):
def runTest(self):
self.msg('Test started')
# ^^^ Insert new recordings here. (Do not remove this line.)
# Code to load and run the test
if __name__ == 'main':
test = MaxQTest("MaxQTest")
test.Run()
# Snippet 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class topClass():
str = 'abc'
def tcMsg(self):
print 'topClass tcMsg'
class one(topClass):
strOne = 'class one'
def classOneFun(self):
print 'this is classOneFun'
self.tcMsg()
if __name__ == 'main':
test = one()
test.classOneFun()