diff options
| author | 2022-12-04 23:25:06 -0500 | |
|---|---|---|
| committer | 2022-12-04 23:25:06 -0500 | |
| commit | 3338dfce719c999467ffe08fd45663be8190057a (patch) | |
| tree | fd3235a1379c19508bbb47b8e8b95d5d9164b0d3 /test/test_formatter.py | |
| parent | 7af5cc29d1c02d20a6890b7b7ba78ab41532a763 (diff) | |
New upstream version 1.24.1.upstream/1.24.1
Diffstat (limited to 'test/test_formatter.py')
| -rw-r--r-- | test/test_formatter.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_formatter.py b/test/test_formatter.py index b335332..50e55a6 100644 --- a/test/test_formatter.py +++ b/test/test_formatter.py @@ -219,6 +219,21 @@ class TestFormatter(unittest.TestCase): time.timezone = orig_timezone time.altzone = orig_altzone + def test_sort(self): + self._run_test("{l:S}" , "['a', 'b', 'c']") + self._run_test("{l:Sa}", "['a', 'b', 'c']") + self._run_test("{l:Sd}", "['c', 'b', 'a']") + self._run_test("{l:Sr}", "['c', 'b', 'a']") + + self._run_test( + "{a:S}", "[' ', 'E', 'L', 'L', 'O', 'd', 'h', 'l', 'o', 'r', 'w']") + self._run_test( + "{a:S-asc}", # starts with 'S', contains 'a' + "[' ', 'E', 'L', 'L', 'O', 'd', 'h', 'l', 'o', 'r', 'w']") + self._run_test( + "{a:Sort-reverse}", # starts with 'S', contains 'r' + "['w', 'r', 'o', 'l', 'h', 'd', 'O', 'L', 'L', 'E', ' ']") + def test_chain_special(self): # multiple replacements self._run_test("{a:Rh/C/RE/e/RL/l/}", "Cello wOrld") @@ -237,6 +252,9 @@ class TestFormatter(unittest.TestCase): # parse and format datetime self._run_test("{ds:D%Y-%m-%dT%H:%M:%S%z/%Y%m%d}", "20100101") + # sort and join + self._run_test("{a:S/J}", " ELLOdhlorw") + def test_separator(self): orig_separator = formatter._SEPARATOR try: |
