555
555
Traceback (most recent call last):
556
556
SyntaxError: expected default value expression
557
557
558
- >>> import ast; ast.parse('''
558
+ # TODO: RUSTPYTHON NameError: name 'PyCF_TYPE_COMMENTS' is not defined
559
+ >>> import ast; ast.parse(''' # doctest: +SKIP
559
560
... def f(
560
561
... *, # type: int
561
562
... a, # type: int
581
582
>>> L = range(10)
582
583
>>> f(x for x in L)
583
584
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
584
- >>> f(x for x in L, 1)
585
+
586
+ # TODO: RUSTPYTHON does not raise.
587
+ >>> f(x for x in L, 1) # doctest: +SKIP
585
588
Traceback (most recent call last):
586
589
SyntaxError: Generator expression must be parenthesized
587
- >>> f(x for x in L, y=1)
590
+
591
+ # TODO: RUSTPYTHON does not raise.
592
+ >>> f(x for x in L, y=1) # doctest: +SKIP
588
593
Traceback (most recent call last):
589
594
SyntaxError: Generator expression must be parenthesized
590
- >>> f(x for x in L, *[])
595
+
596
+ # TODO: RUSTPYTHON does not raise.
597
+ >>> f(x for x in L, *[]) # doctest: +SKIP
591
598
Traceback (most recent call last):
592
599
SyntaxError: Generator expression must be parenthesized
593
- >>> f(x for x in L, **{})
600
+
601
+ # TODO: RUSTPYTHON does not raise.
602
+ >>> f(x for x in L, **{}) # doctest: +SKIP
594
603
Traceback (most recent call last):
595
604
SyntaxError: Generator expression must be parenthesized
596
- >>> f(L, x for x in L)
605
+
606
+ # TODO: RUSTPYTHON does not raise.
607
+ >>> f(L, x for x in L) # doctest: +SKIP
597
608
Traceback (most recent call last):
598
609
SyntaxError: Generator expression must be parenthesized
599
- >>> f(x for x in L, y for y in L)
610
+
611
+ # TODO: RUSTPYTHON does not raise.
612
+ >>> f(x for x in L, y for y in L) # doctest: +SKIP
600
613
Traceback (most recent call last):
601
614
SyntaxError: Generator expression must be parenthesized
602
- >>> f(x for x in L,)
615
+
616
+ # TODO: RUSTPYTHON does not raise.
617
+ >>> f(x for x in L,) # doctest: +SKIP
603
618
Traceback (most recent call last):
604
619
SyntaxError: Generator expression must be parenthesized
605
620
>>> f((x for x in L), 1)
606
621
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
607
- >>> class C(x for x in L):
622
+
623
+ # TODO: RUSTPYTHON TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
624
+ >>> class C(x for x in L): # doctest: +SKIP
608
625
... pass
609
626
Traceback (most recent call last):
610
627
SyntaxError: invalid syntax
740
757
>>> f(__debug__=1)
741
758
Traceback (most recent call last):
742
759
SyntaxError: cannot assign to __debug__
743
- >>> __debug__: int
760
+
761
+ # TODO: RUSTPYTHON NameError: name '__annotations__' is not defined
762
+ >>> __debug__: int # doctest: +SKIP
744
763
Traceback (most recent call last):
745
764
SyntaxError: cannot assign to __debug__
746
765
1574
1593
# Check that we dont raise the "trailing comma" error if there is more
1575
1594
# input to the left of the valid part that we parsed.
1576
1595
1577
- >>> from t import x,y, and 3
1596
+ >>> from t import x,y, and 3
1578
1597
Traceback (most recent call last):
1579
1598
SyntaxError: invalid syntax
1580
1599
1581
- >>> (): int
1600
+ # TODO: RUSTPYTHON nothing raised.
1601
+ >>> (): int # doctest: +SKIP
1582
1602
Traceback (most recent call last):
1583
1603
SyntaxError: only single target (not tuple) can be annotated
1584
- >>> []: int
1604
+ # TODO: RUSTPYTHON nothing raised.
1605
+ >>> []: int # doctest: +SKIP
1585
1606
Traceback (most recent call last):
1586
1607
SyntaxError: only single target (not list) can be annotated
1587
- >>> (()): int
1608
+ # TODO: RUSTPYTHON nothing raised.
1609
+ >>> (()): int # doctest: +SKIP
1588
1610
Traceback (most recent call last):
1589
1611
SyntaxError: only single target (not tuple) can be annotated
1590
- >>> ([]): int
1612
+ # TODO: RUSTPYTHON nothing raised.
1613
+ >>> ([]): int # doctest: +SKIP
1591
1614
Traceback (most recent call last):
1592
1615
SyntaxError: only single target (not list) can be annotated
1593
1616
1611
1634
1612
1635
Corner-cases that used to crash:
1613
1636
1614
- >>> def f(**__debug__): pass
1637
+ # TODO: RUSTPYTHON nothing raised.
1638
+ >>> def f(**__debug__): pass # doctest: +SKIP
1615
1639
Traceback (most recent call last):
1616
1640
SyntaxError: cannot assign to __debug__
1617
1641
@@ -1843,6 +1867,8 @@ def _check_error(self, code, errtext,
1843
1867
else :
1844
1868
self .fail ("compile() did not raise SyntaxError" )
1845
1869
1870
+ # TODO: RUSTPYTHON
1871
+ @unittest .expectedFailure
1846
1872
def test_expression_with_assignment (self ):
1847
1873
self ._check_error (
1848
1874
"print(end1 + end2 = ' ')" ,
@@ -1945,6 +1971,8 @@ def test_break_outside_loop(self):
1945
1971
self ._check_error ("class C:\n if 1: pass\n else: break" ,
1946
1972
"outside loop" )
1947
1973
1974
+ # TODO: RUSTPYTHON
1975
+ @unittest .expectedFailure
1948
1976
def test_continue_outside_loop (self ):
1949
1977
self ._check_error ("if 0: continue" , "not properly in loop" )
1950
1978
self ._check_error ("if 0: continue\n else: x=1" , "not properly in loop" )
@@ -1970,6 +1998,8 @@ def test_kwargs_last(self):
1970
1998
self ._check_error ("int(base=10, '2')" ,
1971
1999
"positional argument follows keyword argument" )
1972
2000
2001
+ # TODO: RUSTPYTHON
2002
+ @unittest .expectedFailure
1973
2003
def test_kwargs_last2 (self ):
1974
2004
self ._check_error ("int(**{'base': 10}, '2')" ,
1975
2005
"positional argument follows "
@@ -1980,11 +2010,15 @@ def test_kwargs_last3(self):
1980
2010
"iterable argument unpacking follows "
1981
2011
"keyword argument unpacking" )
1982
2012
2013
+ # TODO: RUSTPYTHON
2014
+ @unittest .expectedFailure
1983
2015
def test_generator_in_function_call (self ):
1984
2016
self ._check_error ("foo(x, y for y in range(3) for z in range(2) if z , p)" ,
1985
2017
"Generator expression must be parenthesized" ,
1986
2018
lineno = 1 , end_lineno = 1 , offset = 11 , end_offset = 53 )
1987
2019
2020
+ # TODO: RUSTPYTHON
2021
+ @unittest .expectedFailure
1988
2022
def test_empty_line_after_linecont (self ):
1989
2023
# See issue-40847
1990
2024
s = r"""\
@@ -2039,6 +2073,8 @@ def test_nested_named_except_blocks(self):
2039
2073
code += f"{ ' ' * 4 * 12 } pass"
2040
2074
self ._check_error (code , "too many statically nested blocks" )
2041
2075
2076
+ # TODO: RUSTPYTHON
2077
+ @unittest .expectedFailure
2042
2078
def test_barry_as_flufl_with_syntax_errors (self ):
2043
2079
# The "barry_as_flufl" rule can produce some "bugs-at-a-distance" if
2044
2080
# is reading the wrong token in the presence of syntax errors later
@@ -2056,6 +2092,8 @@ def func2():
2056
2092
"""
2057
2093
self ._check_error (code , "expected ':'" )
2058
2094
2095
+ # TODO: RUSTPYTHON
2096
+ @unittest .expectedFailure
2059
2097
def test_invalid_line_continuation_error_position (self ):
2060
2098
self ._check_error (r"a = 3 \ 4" ,
2061
2099
"unexpected character after line continuation character" ,
@@ -2075,6 +2113,8 @@ def test_invalid_line_continuation_left_recursive(self):
2075
2113
self ._check_error ("A.\u03bc \\ \n " ,
2076
2114
"unexpected EOF while parsing" )
2077
2115
2116
+ # TODO: RUSTPYTHON
2117
+ @unittest .expectedFailure
2078
2118
def test_error_parenthesis (self ):
2079
2119
for paren in "([{" :
2080
2120
self ._check_error (paren + "1 + 2" , f"\\ { paren } ' was never closed" )
@@ -2085,6 +2125,8 @@ def test_error_parenthesis(self):
2085
2125
for paren in ")]}" :
2086
2126
self ._check_error (paren + "1 + 2" , f"unmatched '\\ { paren } '" )
2087
2127
2128
+ # TODO: RUSTPYTHON
2129
+ @unittest .expectedFailure
2088
2130
def test_invisible_characters (self ):
2089
2131
self ._check_error ('print\x17 ("Hello")' , "invalid non-printable character" )
2090
2132
@@ -2166,7 +2208,8 @@ def test_deep_invalid_rule(self):
2166
2208
2167
2209
2168
2210
def load_tests (loader , tests , pattern ):
2169
- tests .addTest (doctest .DocTestSuite ())
2211
+ # TODO: RUSTPYTHON Eventually remove the optionflags for ingoring exception details.
2212
+ tests .addTest (doctest .DocTestSuite (optionflags = doctest .IGNORE_EXCEPTION_DETAIL ))
2170
2213
return tests
2171
2214
2172
2215
0 commit comments