add 'j' format string conversion

to convert to a JSON formatted string
This commit is contained in:
Mike Fährmann
2021-08-28 01:19:36 +02:00
parent 6651da27e9
commit 292fffc83c
3 changed files with 9 additions and 0 deletions

View File

@@ -297,6 +297,7 @@ class TestFormatter(unittest.TestCase):
self._run_test("{t!d}", datetime.datetime(2010, 1, 1))
self._run_test("{t!d:%Y-%m-%d}", "2010-01-01")
self._run_test("{dt!T}", "1262304000")
self._run_test("{l!j}", '["a", "b", "c"]')
with self.assertRaises(KeyError):
self._run_test("{a!q}", "hello world")