File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change 1+ import doctest
2+ import unittest
3+
4+
15doctests = """
26
37Unpack tuple
142146
143147__test__ = {'doctests' : doctests }
144148
145- def test_main (verbose = False ):
146- from test import support
147- from test import test_unpack
148- support .run_doctest (test_unpack , verbose )
149+ def load_tests (loader , tests , pattern ):
150+ tests .addTest (doctest .DocTestSuite ())
151+ return tests
152+
153+
154+ class TestCornerCases (unittest .TestCase ):
155+ def test_extended_oparg_not_ignored (self ):
156+ # https://github.com/python/cpython/issues/91625
157+ target = "(" + "y," * 400 + ")"
158+ code = f"""def unpack_400(x):
159+ { target } = x
160+ return y
161+ """
162+ ns = {}
163+ exec (code , ns )
164+ unpack_400 = ns ["unpack_400" ]
165+ # Warm up the the function for quickening (PEP 659)
166+ for _ in range (30 ):
167+ y = unpack_400 (range (400 ))
168+ self .assertEqual (y , 399 )
149169
150170if __name__ == "__main__" :
151- test_main ( verbose = True )
171+ unittest . main ( )
You can’t perform that action at this time.
0 commit comments