Files
RustPython/extra_tests/snippets/stdlib_sys_getframe.py
Rex Ledesma 4e2e0b41c6 chore: add ruff format --check (#5774)
* chore: add `ruff format --check`

* fix tests
2025-05-12 14:20:01 +09:00

26 lines
463 B
Python

import sys
value = 189
locals_dict = sys._getframe().f_locals
assert locals_dict["value"] == 189
foo = "bar"
assert locals_dict["foo"] == foo
def test_function():
x = 17
assert sys._getframe().f_locals is not locals_dict
assert sys._getframe().f_locals["x"] == 17
assert sys._getframe(1).f_locals["foo"] == "bar"
test_function()
class TestClass:
def __init__(self):
assert sys._getframe().f_locals["self"] == self
TestClass()