Beispiel #1
0
def test_format_number():
    np.testing.assert_equal(misc._format_number(-1234, 2, 6), '-1234')
    np.testing.assert_equal(misc._format_number(-12345, 2, 6), '-12345')
    np.testing.assert_equal(misc._format_number(123456, 2, 6), '123456')
    np.testing.assert_equal(misc._format_number(-123456, 2, 6), '-1.2e5')
    np.testing.assert_equal(misc._format_number(1234567, 2, 6), '1.2e6')
    np.testing.assert_equal(misc._format_number(0.12, 2, 6), '0.12')
    np.testing.assert_equal(misc._format_number(3.32, 2, 6), '3.32')
    np.testing.assert_equal(misc._format_number(3.3, 2, 6), '3.3')
    np.testing.assert_equal(misc._format_number(3.32, 2, 6), '3.32')
    np.testing.assert_equal(misc._format_number(3.323945, 2, 6), '3.32')
    np.testing.assert_equal(misc._format_number(-0.0003434, 2, 6), '-3.4e-4')
    np.testing.assert_equal(misc._format_number(1654.25, 2, 6), '1654.2')
    np.testing.assert_equal(misc._format_number(-1654.25, 2, 6), '-1654')
    np.testing.assert_equal(misc._format_number(-165.25, 2, 6), '-165.2')
    np.testing.assert_equal(misc._format_number(9.94598693e-01, 2, 6), '0.99')
    np.testing.assert_equal(misc._format_number(-9.94598693e-01, 2, 6), '-0.99')
Beispiel #2
0
 def test_format_number(self):
     np.testing.assert_equal(misc._format_number(-1234, 2, 6), '-1234')
     np.testing.assert_equal(misc._format_number(-12345, 2, 6), '-12345')
     np.testing.assert_equal(misc._format_number(123456, 2, 6), '123456')
     np.testing.assert_equal(misc._format_number(-123456, 2, 6), '-1.2e5')
     np.testing.assert_equal(misc._format_number(1234567, 2, 6), '1.2e6')
     np.testing.assert_equal(misc._format_number(0.12, 2, 6), '0.12')
     np.testing.assert_equal(misc._format_number(3.32, 2, 6), '3.32')
     np.testing.assert_equal(misc._format_number(3.3, 2, 6), '3.3')
     np.testing.assert_equal(misc._format_number(3.32, 2, 6), '3.32')
     np.testing.assert_equal(misc._format_number(3.323945, 2, 6), '3.32')
     np.testing.assert_equal(misc._format_number(-0.0003434, 2, 6),
                             '-3.4e-4')
     np.testing.assert_equal(misc._format_number(1654.25, 2, 6), '1654.2')
     np.testing.assert_equal(misc._format_number(-1654.25, 2, 6), '-1654')
     np.testing.assert_equal(misc._format_number(-165.25, 2, 6), '-165.2')
     np.testing.assert_equal(misc._format_number(9.94598693e-01, 2, 6),
                             '0.99')
     np.testing.assert_equal(misc._format_number(-9.94598693e-01, 2, 6),
                             '-0.99')