aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_formatter.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_formatter.py')
-rw-r--r--test/test_formatter.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_formatter.py b/test/test_formatter.py
index 8464b1b..4cce8a3 100644
--- a/test/test_formatter.py
+++ b/test/test_formatter.py
@@ -232,6 +232,14 @@ class TestFormatter(unittest.TestCase):
self._run_test("\fE name * 2 + ' ' + a", "{}{} {}".format(
self.kwdict["name"], self.kwdict["name"], self.kwdict["a"]))
+ @unittest.skipIf(sys.hexversion < 0x3060000, "no fstring support")
+ def test_fstring(self):
+ self._run_test("\fF {a}", self.kwdict["a"])
+ self._run_test("\fF {name}{name} {a}", "{}{} {}".format(
+ self.kwdict["name"], self.kwdict["name"], self.kwdict["a"]))
+ self._run_test("\fF foo-'\"{a.upper()}\"'-bar",
+ """foo-'"{}"'-bar""".format(self.kwdict["a"].upper()))
+
def test_module(self):
with tempfile.TemporaryDirectory() as tmpdirname:
path = os.path.join(tmpdirname, "testmod.py")