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