Lines Matching refs:get_fmt
869 def get_fmt(x, locale, fmt='n'): function
872 self.assertEqual(get_fmt(Decimal('12.7'), en_US), '12.7')
873 self.assertEqual(get_fmt(Decimal('12.7'), fr_FR), '12,7')
874 self.assertEqual(get_fmt(Decimal('12.7'), ru_RU), '12,7')
875 self.assertEqual(get_fmt(Decimal('12.7'), crazy), '1-2&7')
877 self.assertEqual(get_fmt(123456789, en_US), '123,456,789')
878 self.assertEqual(get_fmt(123456789, fr_FR), '123456789')
879 self.assertEqual(get_fmt(123456789, ru_RU), '123 456 789')
880 self.assertEqual(get_fmt(1234567890123, crazy), '123456-78-9012-3')
882 self.assertEqual(get_fmt(123456789, en_US, '.6n'), '1.23457e+8')
883 self.assertEqual(get_fmt(123456789, fr_FR, '.6n'), '1,23457e+8')
884 self.assertEqual(get_fmt(123456789, ru_RU, '.6n'), '1,23457e+8')
885 self.assertEqual(get_fmt(123456789, crazy, '.6n'), '1&23457e+8')
888 self.assertEqual(get_fmt(1234, fr_FR, '03n'), '1234')
889 self.assertEqual(get_fmt(1234, fr_FR, '04n'), '1234')
890 self.assertEqual(get_fmt(1234, fr_FR, '05n'), '01234')
891 self.assertEqual(get_fmt(1234, fr_FR, '06n'), '001234')
893 self.assertEqual(get_fmt(12345, en_US, '05n'), '12,345')
894 self.assertEqual(get_fmt(12345, en_US, '06n'), '12,345')
895 self.assertEqual(get_fmt(12345, en_US, '07n'), '012,345')
896 self.assertEqual(get_fmt(12345, en_US, '08n'), '0,012,345')
897 self.assertEqual(get_fmt(12345, en_US, '09n'), '0,012,345')
898 self.assertEqual(get_fmt(12345, en_US, '010n'), '00,012,345')
900 self.assertEqual(get_fmt(123456, crazy, '06n'), '1-2345-6')
901 self.assertEqual(get_fmt(123456, crazy, '07n'), '1-2345-6')
902 self.assertEqual(get_fmt(123456, crazy, '08n'), '1-2345-6')
903 self.assertEqual(get_fmt(123456, crazy, '09n'), '01-2345-6')
904 self.assertEqual(get_fmt(123456, crazy, '010n'), '0-01-2345-6')
905 self.assertEqual(get_fmt(123456, crazy, '011n'), '0-01-2345-6')
906 self.assertEqual(get_fmt(123456, crazy, '012n'), '00-01-2345-6')
907 self.assertEqual(get_fmt(123456, crazy, '013n'), '000-01-2345-6')