add 't' format string conversion (closes #1065)
to Trim whitespace from the beginning and end of strings.
Example: '{field!t}' becomes 'foo' for 'field' == " \nfoo\t\r"
This commit is contained in:
@@ -265,6 +265,7 @@ class TestFormatter(unittest.TestCase):
|
||||
"d": {"a": "foo", "b": 0, "c": None},
|
||||
"l": ["a", "b", "c"],
|
||||
"n": None,
|
||||
"s": " \n\r\tSPACE ",
|
||||
"u": "%27%3C%20/%20%3E%27",
|
||||
"name": "Name",
|
||||
"title1": "Title",
|
||||
@@ -278,6 +279,7 @@ 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("{s!t}", "SPACE")
|
||||
self._run_test("{a!U}", self.kwdict["a"])
|
||||
self._run_test("{u!U}", "'< / >'")
|
||||
self._run_test("{a!s}", self.kwdict["a"])
|
||||
|
||||
Reference in New Issue
Block a user