File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,13 @@ impl FormatSpec {
424424 const fn get_separator_interval ( & self ) -> usize {
425425 match self . format_type {
426426 Some ( FormatType :: Binary | FormatType :: Octal | FormatType :: Hex ( _) ) => 4 ,
427- Some ( FormatType :: Decimal | FormatType :: Number ( _) | FormatType :: FixedPoint ( _) ) => 3 ,
427+ Some (
428+ FormatType :: Decimal
429+ | FormatType :: FixedPoint ( _)
430+ | FormatType :: GeneralFormat ( _)
431+ | FormatType :: Exponent ( _)
432+ | FormatType :: Percentage ,
433+ ) => 3 ,
428434 None => 3 ,
429435 _ => panic ! ( "Separators only valid for numbers!" ) ,
430436 }
Original file line number Diff line number Diff line change @@ -188,6 +188,11 @@ def test_zero_padding():
188188assert f"{ 12345.6 + 7890.1j :,} " == "(12,345.6+7,890.1j)"
189189assert f"{ 12345.6 + 7890.1j :_.3f} " == "12_345.600+7_890.100j"
190190assert f"{ 12345.6 + 7890.1j :>+30,f} " == " +12,345.600000+7,890.100000j"
191+ assert f"{ 123456 :,g} " == "123,456"
192+ assert f"{ 123456 :,G} " == "123,456"
193+ assert f"{ 123456 :,e} " == "1.234560e+05"
194+ assert f"{ 123456 :,E} " == "1.234560E+05"
195+ assert f"{ 123456 :,%} " == "12,345,600.000000%"
191196
192197# test issue 4558
193198x = 123456789012345678901234567890
You can’t perform that action at this time.
0 commit comments