在shell中使用UnitTest:
python3.4 -m unittest my_test.py -v
我得到了DeprecationWarning
DeprecationWarning: The value of convert_charrefs will become True in 3.5. You are encouraged to set the value explicitly. super().__init__() ERROR
所以看来
super().__init__()
触发此DeprecationWarning。但是我找不到有关convert_charrefs警告的任何信息。在Python文档中也使用了used语句,在SO中使用了多个示例。
导致此警告的原因是什么,我该如何解决?感谢。
答案 0 :(得分:1)
convert_charrefs
对应HTMLParser
。如果从此类继承,则必须显式指定convert_charrefs:
class Foo(HTMLParser):
def __init__(self):
super().__init__(convert_charrefs=True)