There was an error while loading. Please reload this page.
1 parent 76b6c24 commit 01fc932Copy full SHA for 01fc932
1 file changed
patterns/structural/decorator.py
@@ -55,12 +55,18 @@ def render(self):
55
return "<i>{}</i>".format(self._wrapped.render())
56
57
58
+def main():
59
+ """
60
+ >>> simple_hello = TextTag("hello, world!")
61
+ >>> special_hello = ItalicWrapper(BoldWrapper(simple_hello))
62
+
63
+ >>> print("before:", simple_hello.render())
64
+ before: hello, world!
65
66
+ >>> print("after:", special_hello.render())
67
+ after: <i><b>hello, world!</b></i>
68
69
70
if __name__ == '__main__':
- simple_hello = TextTag("hello, world!")
- special_hello = ItalicWrapper(BoldWrapper(simple_hello))
- print("before:", simple_hello.render())
- print("after:", special_hello.render())
-
-### OUTPUT ###
-# before: hello, world!
-# after: <i><b>hello, world!</b></i>
71
+ import doctest
72
+ doctest.testmod()
0 commit comments