Next / Previous / Contents / Shipman's homepage

30. confactest: Test unit conversions

This is a small test driver to exercise all the possible unit conversions within the FoDim class.

#!/usr/bin/env python
# confactest:  Test driver for FoDim.confactor()
#   For documentation, see:

import fohelpers as h

u = h.FoDim.unitList

for fromPos in range(0, len(u)):
    for toPos in range(0, len(u)):
        factor = h.FoDim.confactor(u[fromPos], u[toPos])
        print ( "To convert from %s to %s, multiply by %s" %
                (u[fromPos], u[toPos], factor) )