diff options
Diffstat (limited to 'tests/basics')
-rw-r--r-- | tests/basics/errno1.py | 4 | ||||
-rw-r--r-- | tests/basics/errno1.py.exp | 1 | ||||
-rw-r--r-- | tests/basics/int_constfolding.py | 6 | ||||
-rw-r--r-- | tests/basics/syntaxerror.py | 4 |
4 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/errno1.py b/tests/basics/errno1.py index 63930b767..d7a5ccd54 100644 --- a/tests/basics/errno1.py +++ b/tests/basics/errno1.py @@ -15,3 +15,7 @@ print(msg[:7], msg[-5:]) # check that unknown errno is still rendered print(str(OSError(9999))) + +# this tests a failed constant lookup in errno +errno = uerrno +print(errno.__name__) diff --git a/tests/basics/errno1.py.exp b/tests/basics/errno1.py.exp index c3703df4a..7dd22757d 100644 --- a/tests/basics/errno1.py.exp +++ b/tests/basics/errno1.py.exp @@ -1,3 +1,4 @@ <class 'int'> [Errno ] EIO 9999 +uerrno diff --git a/tests/basics/int_constfolding.py b/tests/basics/int_constfolding.py index 7bb538378..158897f55 100644 --- a/tests/basics/int_constfolding.py +++ b/tests/basics/int_constfolding.py @@ -29,3 +29,9 @@ print(123 // 7, 123 % 7) print(-123 // 7, -123 % 7) print(123 // -7, 123 % -7) print(-123 // -7, -123 % -7) + +# won't fold so an exception can be raised at runtime +try: + 1 << -1 +except ValueError: + print('ValueError') diff --git a/tests/basics/syntaxerror.py b/tests/basics/syntaxerror.py index 4161de017..843459f0b 100644 --- a/tests/basics/syntaxerror.py +++ b/tests/basics/syntaxerror.py @@ -29,6 +29,10 @@ test_syntax(" a\n") # malformed integer literal (parser error) test_syntax("123z") +# input doesn't match the grammar (parser error) +test_syntax('1 or 2 or') +test_syntax('{1:') + # can't assign to literals test_syntax("1 = 2") test_syntax("'' = 1") |