Author: Antoine Dupre <[email protected]>
Branch: py3.6
Changeset: r94916:56432e26b463
Date: 2018-07-28 15:22 +0200
http://bitbucket.org/pypy/pypy/changeset/56432e26b463/

Log:    (duprean, antocuni) Test and fix for fstring exception message to
        mimic Cpython

diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -583,7 +583,7 @@
 
         def _unknown_presentation(self, w_val):
             raise oefmt(self.space.w_ValueError,
-                        "unknown format code %s for object of type '%T'", 
self._type, w_val)
+                        "Unknown format code %s for object of type '%T'", 
self._type, w_val)
 
         def format_string(self, w_string):
             space = self.space
diff --git a/pypy/objspace/std/test/test_fsting.py 
b/pypy/objspace/std/test/test_fsting.py
new file mode 100644
--- /dev/null
+++ b/pypy/objspace/std/test/test_fsting.py
@@ -0,0 +1,8 @@
+class AppTestFstring:
+    def test_error_unknown_code(self):
+        """
+        def fn():
+            f'{1000:j}'
+        exc_info = raises(ValueError, fn)
+        assert str(exc_info.value).startswith("Unknown format code")
+        """
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to