class TestDataAxis: def setUp(self): self.axis = DataAxis(size=2048, scale=12E-12, units='m') def test_convert_to_convenient_scale_units(self): self.axis.convert_to_convenient_scale_units() nt.assert_almost_equal(self.axis.scale, 0.012, places=5) nt.assert_equal(self.axis.units, 'nm') def test_convert_to_units(self): self.axis.convert_to_units('µm') nt.assert_almost_equal(self.axis.scale, 12E-6, places=5) nt.assert_equal(self.axis.units, 'µm')