implement R<old>/<new>/ format option (#318)

This commit is contained in:
Mike Fährmann
2019-06-23 22:41:03 +02:00
parent 18a1f8c6cd
commit 95b1e4c3c0
3 changed files with 25 additions and 1 deletions

View File

@@ -27,7 +27,6 @@ TRAVIS_SKIP = {
# temporary issues, etc.
BROKEN = {
"mangapark",
"pixnet",
}

View File

@@ -264,6 +264,15 @@ class TestFormatter(unittest.TestCase):
self._run_test("{a:J/}" , self.kwdict["a"])
self._run_test("{a:J, /}" , ", ".join(self.kwdict["a"]))
def test_replace(self):
self._run_test("{a:Rh/C/}" , "CElLo wOrLd")
self._run_test("{a!l:Rh/C/}", "Cello world")
self._run_test("{a!u:Rh/C/}", "HELLO WORLD")
self._run_test("{a!l:Rl/_/}", "he__o wor_d")
self._run_test("{a!l:Rl//}" , "heo word")
self._run_test("{name:Rame/othing/}", "Nothing")
def _run_test(self, format_string, result, default=None):
formatter = util.Formatter(format_string, default)
output = formatter.format_map(self.kwdict)