def test_update_library(self):
        # Show no existing support.
        x = units.PhysicalQuantity('1m/s')
        try:
            x.convert_to_unit('furlong/fortnight')
        except __HOLE__, exc:
            self.assertEqual(str(exc), "no unit named 'furlong' is defined")
        else:
            self.fail("ValueError expected")

        # Update.
        update = cStringIO.StringIO("""
[units]
furlong: 201.168*m, Horse racing
fortnight: 14*d, Two weeks
""")
        units.update_library(update)

        # Show supported.
        x = units.PhysicalQuantity('1m/s')
        x.convert_to_unit('furlong/fortnight')
        self.assertAlmostEqual(x.value,
                               units.PhysicalQuantity(
                               '6012.884753furlong/fortnight').value, places=5)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.units/openmdao/units/test/test_units.py/test_moduleLevelFunctions.test_update_library