def build_test(table):
    "build a test for all getters and setters for each class"
    name, baseunits = table[0]
    s = '\n%s conversion class\n' % name
    s += '>>> from conversion import %s\n' % (name)
    s += '>>> %s = %s(0.0)\n' % (name.lower()[0],name)
    args = [arg[1] for arg in table[1:]]
    for arg in args:
        s += '>>> %s.%s = 1.0\n' % (name.lower()[0],arg)
        s += '>>> print %s\n' % (name.lower()[0])
        x = eval('%s()' % name)
        exec('x.%s = 1.0' % arg)
        for line in str(x).split('\n'):
            s += '%s\n' % line
        s += '>>> %s\n' % (name.lower()[0])
        x = eval('%s()' % name)
        exec('x.%s = 1.0' % arg)
        for line in repr(x).split('\n'):
            s += '%s\n' % line
    s += '\n'
    return s
build a test for all getters and setters for each class
recipes/Python/577652_Unit_Conversions_Using_Decimal/recipe-577652.py