From 3338dfce719c999467ffe08fd45663be8190057a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sun, 4 Dec 2022 23:25:06 -0500 Subject: New upstream version 1.24.1. --- test/test_formatter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') 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: -- cgit v1.2.3