view tests/test_ini.txt @ 37:5268ab85fe1b

stub a fibonacci sequence for testing
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 07 Jun 2011 19:14:04 -0700
parents a9eaf65d82c6
children f6616a5f468f
line wrap: on
line source

Test IniFactory
===============

Let's test the .ini factory::

    >>> import os
    >>> from pyloader.factory import IniFactory
    >>> inifile = os.path.join(here, 'test.ini')
    >>> inifactory = IniFactory(inifile)

Load it up::

    >>> object = inifactory.load()
    >>> 'objects.py.StringMunge' in repr(object.__class__)
    True

Call it::

    >>> object('foobar')
    'PRE!!!abfoor'

You can also just load the callback::

    >>> callback = inifactory.load('callback')
    >>> callback('foo', 'bar')
    'abfoor'