parent
8cdce21dcb
commit
2fad0b1f1b
@ -284,6 +284,7 @@ class Formatter():
|
||||
- "u": calls str.upper
|
||||
- "c": calls str.capitalize
|
||||
- "C": calls string.capwords
|
||||
- "U": calls urllib.parse.unquote
|
||||
- Example: {f!l} -> "example"; {f!u} -> "EXAMPLE"
|
||||
|
||||
Extra Format Specifiers:
|
||||
@ -298,6 +299,7 @@ class Formatter():
|
||||
"u": str.upper,
|
||||
"c": str.capitalize,
|
||||
"C": string.capwords,
|
||||
"U": urllib.parse.unquote,
|
||||
"s": str,
|
||||
"r": repr,
|
||||
"a": ascii,
|
||||
|
@ -145,6 +145,7 @@ class TestFormatter(unittest.TestCase):
|
||||
kwdict = {
|
||||
"a": "hElLo wOrLd",
|
||||
"b": "äöü",
|
||||
"u": "%27%3C%20/%20%3E%27",
|
||||
"name": "Name",
|
||||
"title1": "Title",
|
||||
"title2": "",
|
||||
@ -157,6 +158,8 @@ class TestFormatter(unittest.TestCase):
|
||||
self._run_test("{a!u}", "HELLO WORLD")
|
||||
self._run_test("{a!c}", "Hello world")
|
||||
self._run_test("{a!C}", "Hello World")
|
||||
self._run_test("{a!U}", self.kwdict["a"])
|
||||
self._run_test("{u!U}", "'< / >'")
|
||||
self._run_test("{a!s}", self.kwdict["a"])
|
||||
self._run_test("{a!r}", "'" + self.kwdict["a"] + "'")
|
||||
self._run_test("{a!a}", "'" + self.kwdict["a"] + "'")
|
||||
|
Loading…
x
Reference in New Issue
Block a user