1

Using UnitTest in the shell:

python3.4 -m unittest my_test.py -v

I get the DeprecationWarning

DeprecationWarning: The value of convert_charrefs will become True in 3.5. You are encouraged to set the value explicitly.  super().__init__() ERROR

So it seems

super().__init__()

triggers this DeprecationWarning. But I can not find anything about convert_charrefs warning. Also the used statement is used in the Python documentation, and multiple examples in SO.

What causes this warning, and how can I solve this? Thanks.

Bernard
  • 681
  • 1
  • 8
  • 21
  • `convert_charrefs` correspond to `HTMLParser`. If you inherit from this class you must explicitly specify convert_charrefs: `class Foo(HTMLParser): def __init__(self): super().__init__(convert_charrefs=True)` – aiven Jan 11 '18 at 09:13
  • Thats it. Solved. Thanks very much @Aiven – Bernard Jan 11 '18 at 09:30
  • I want to accept your answer, but could not find where to do so. – Bernard Jan 11 '18 at 09:34
  • You can't accept comment, but I can move it to the answers section (: – aiven Jan 11 '18 at 10:02

1 Answers1

1

convert_charrefs correspond to HTMLParser. If you inherit from this class you must explicitly specify convert_charrefs:

class Foo(HTMLParser): 
  def __init__(self): 
    super().__init__(convert_charrefs=True)
aiven
  • 3,775
  • 3
  • 27
  • 52