[formatter] implement 'A' format specifier (#6036)

This commit is contained in:
Mike Fährmann
2024-08-16 20:34:23 +02:00
parent 01e8433889
commit 78ae0ba9f7
3 changed files with 30 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ class TestFormatter(unittest.TestCase):
"b": "äöü",
"j": "げんそうきょう",
"d": {"a": "foo", "b": 0, "c": None},
"i": 2,
"l": ["a", "b", "c"],
"n": None,
"s": " \n\r\tSPACE ",
@@ -267,6 +268,11 @@ class TestFormatter(unittest.TestCase):
"{a:Sort-reverse}", # starts with 'S', contains 'r'
"['w', 'r', 'o', 'l', 'h', 'd', 'O', 'L', 'L', 'E', ' ']")
def test_specifier_arithmetic(self):
self._run_test("{i:A+1}", "3")
self._run_test("{i:A-1}", "1")
self._run_test("{i:A*3}", "6")
def test_specifier_conversions(self):
self._run_test("{a:Cl}" , "hello world")
self._run_test("{h:CHC}" , "Foo & Bar")