mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Update test_dynamic.py from CPython v3.12.0
This commit is contained in:
1 parent
186eac5095
commit
f7c7398ba8
1 file changed
+7
-5
Vendored
+7
-5
@@ -142,12 +142,14 @@ class RebindBuiltinsTests(unittest.TestCase):
|
||||
def __missing__(self, key):
|
||||
return int(key.removeprefix("_number_"))
|
||||
|
||||
code = "lambda: " + "+".join(f"_number_{i}" for i in range(1000))
|
||||
sum_1000 = eval(code, MyGlobals())
|
||||
expected = sum(range(1000))
|
||||
# Warm up the the function for quickening (PEP 659)
|
||||
# Need more than 256 variables to use EXTENDED_ARGS
|
||||
variables = 400
|
||||
code = "lambda: " + "+".join(f"_number_{i}" for i in range(variables))
|
||||
sum_func = eval(code, MyGlobals())
|
||||
expected = sum(range(variables))
|
||||
# Warm up the function for quickening (PEP 659)
|
||||
for _ in range(30):
|
||||
self.assertEqual(sum_1000(), expected)
|
||||
self.assertEqual(sum_func(), expected)
|
||||
|
||||
|
||||
class TestTracing(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user