[pypy-commit] pypy pep526: Catch expected exception in test_annotations.

alcarithemad pypy.commits at gmail.com
Thu Mar 1 05:08:04 EST 2018


Author: Colin Valliant <alcarithemad at gmail.com>
Branch: pep526
Changeset: r93921:c9cec4aab2cc
Date: 2018-02-14 22:09 -0800
http://bitbucket.org/pypy/pypy/changeset/c9cec4aab2cc/

Log:	Catch expected exception in test_annotations.

diff --git a/pypy/interpreter/test/test_annotations.py b/pypy/interpreter/test/test_annotations.py
--- a/pypy/interpreter/test/test_annotations.py
+++ b/pypy/interpreter/test/test_annotations.py
@@ -59,8 +59,13 @@
         class C:
             def __init__(self):
                 self.x: invalid_name = 1
-                y[0]: also_invalid
                 assert self.x == 1
+                try:
+                    # this is invalid because `y` is undefined
+                    # it should raise a NameError
+                    y[0]: also_invalid
+                except NameError:
+                    ...
         C()
         '''
 


More information about the pypy-commit mailing list