@@ -52,20 +52,22 @@ def unregister_object(self, name):
52
52
53
53
54
54
def main ():
55
- dispatcher = PrototypeDispatcher ()
56
- prototype = Prototype ()
55
+ """
56
+ >>> dispatcher = PrototypeDispatcher()
57
+ >>> prototype = Prototype()
57
58
58
- d = prototype .clone ()
59
- a = prototype .clone (value = 'a-value' , category = 'a' )
60
- b = prototype .clone (value = 'b-value' , is_checked = True )
61
- dispatcher .register_object ('objecta' , a )
62
- dispatcher .register_object ('objectb' , b )
63
- dispatcher .register_object ('default' , d )
64
- print ([{n : p .value } for n , p in dispatcher .get_objects ().items ()])
59
+ >>> d = prototype.clone()
60
+ >>> a = prototype.clone(value='a-value', category='a')
61
+ >>> b = prototype.clone(value='b-value', is_checked=True)
62
+ >>> dispatcher.register_object('objecta', a)
63
+ >>> dispatcher.register_object('objectb', b)
64
+ >>> dispatcher.register_object('default', d)
65
65
66
+ >>> [{n: p.value} for n, p in dispatcher.get_objects().items()]
67
+ [{'objecta': 'a-value'}, {'objectb': 'b-value'}, {'default': 'default'}]
68
+ """
66
69
67
- if __name__ == '__main__' :
68
- main ()
69
70
70
- ### OUTPUT ###
71
- # [{'objectb': 'b-value'}, {'default': 'default'}, {'objecta': 'a-value'}]
71
+ if __name__ == '__main__' :
72
+ import doctest
73
+ doctest .testmod ()
0 commit comments