Fix FormattedString test failure.

Initialize FormattedString().attributes to DEFAULT_ATTRIBUTES so all the
attributes are always present. FormattedString is now a class, not
a namedtuple instance.
This commit is contained in:
Denis Kasak 2018-11-07 13:31:33 +01:00
parent 9b6ca78866
commit ef7b2b7eaf

View file

@ -43,7 +43,13 @@ except ImportError:
from html.parser import HTMLParser
FormattedString = namedtuple("FormattedString", ["text", "attributes"])
class FormattedString:
__slots__ = ("text", "attributes")
def __init__(self, text, attributes):
self.attributes = DEFAULT_ATTRIBUTES.copy()
self.attributes.update(attributes)
self.text = text
class Formatted(object):