Merge pull request #4403 from yt2b/fix_exponential_format

Fix exponential format
This commit is contained in:
Jeong YunWon
2023-01-03 04:33:07 +09:00
committed by GitHub
2 changed files with 5 additions and 7 deletions

View File

@@ -513,13 +513,9 @@ impl FormatSpec {
Some(_) | None => Err("%c arg not in range(0x110000)"),
},
},
Some(FormatType::GeneralFormatUpper) => {
Err("Unknown format code 'G' for object of type 'int'")
}
Some(FormatType::GeneralFormatLower) => {
Err("Unknown format code 'g' for object of type 'int'")
}
Some(FormatType::FixedPointUpper)
Some(FormatType::GeneralFormatUpper)
| Some(FormatType::GeneralFormatLower)
| Some(FormatType::FixedPointUpper)
| Some(FormatType::FixedPointLower)
| Some(FormatType::ExponentUpper)
| Some(FormatType::ExponentLower)

View File

@@ -64,3 +64,5 @@ assert f"{123.456:09,}" == "0,123.456"
assert f"{123.456:010,}" == "00,123.456"
assert f"{123.456:011,}" == "000,123.456"
assert f"{123.456:+011,}" == "+00,123.456"
assert f"{1234:.3g}" == "1.23e+03"
assert f"{1234567:.6G}" == "1.23457E+06"