diff tests/test_factory.txt @ 15:0bea5297c156

introduce a more betterer test
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 27 May 2011 18:56:00 -0700
parents ff272dcd5cd8
children 11039ffec62a
line wrap: on
line diff
--- a/tests/test_factory.txt	Fri May 27 18:43:14 2011 -0700
+++ b/tests/test_factory.txt	Fri May 27 18:56:00 2011 -0700
@@ -5,6 +5,7 @@
 
     >>> import os
     >>> from pyloader.factory import PyFactory
+    >>> objects = os.path.join(here, 'objects.py')
 
 Construct a factory::
 
@@ -12,7 +13,7 @@
 
 Make a configuration::
 
-    >>> config = {'': {'path': os.path.join(here, 'objects.py:stringsort'), 'args': ['foo', 'bar']}} 
+    >>> config = {'': {'path': objects + ':stringsort', 'args': ['foo', 'bar']}} 
 
 Load it::
 
@@ -22,3 +23,12 @@
 
     >>> factory.load()
     'abfoor'
+
+Now lets try something better!::
+
+    >>> config = {'': {'path': objects + ':StringMunge', 'kwargs': {'prefix': 'PRE', 'callback': '%(callback)s'}},
+    ...           'callback': {'path': objects + ':stringsort'} }
+    >>> factory.configure(config)
+    >>> obj = factory.load()
+    >>> obj('foobar')
+    'PRE:abfoor'