运行测试用例时发现以下报错 Ran 1 test in 22.505s FAILED (errors=1) Error Traceback (most recent call last): File "D:\Program\python34\lib\unittest\case.py", line 58, in testPartExecutor yield File "D:\Program\python34\lib\unittest\case.py", line 58…
TypeError: object() takes no parameters TypeError: this constructor takes no arguments 如下是学习python类时遇到的一个小例子.经过查阅资料才知道,是构造函数写错的问题, __init__(self,name)这个构造函数的左右下划线都是两个,我只用了一个,导致错误.…
class Song(object): def __init__(self,lyrics): self.lyrics = lyrics def sing_me_a_song(self): for line in self.lyrics: print line happy_bday = Song(["happy birthday to you "," I dont want to get sued","so i'll stop right there&quo…