Files
RustPython/tests/snippets/delete.py
Christian Clauss b174453677 Travis CI: Lint Python code with flake8
These tests focus on Python syntax errors and undefined names.
2019-07-23 12:36:22 +02:00

22 lines
364 B
Python

from testutils import assert_raises, assertRaises
a = 1
del a
class MyObject: pass
foo = MyObject()
foo.bar = 2
assert hasattr(foo, 'bar')
del foo.bar
assert not hasattr(foo, 'bar')
x = 1
y = 2
del (x, y)
assert_raises(NameError, lambda: x) # noqa: F821
assert_raises(NameError, lambda: y) # noqa: F821
with assertRaises(NameError):
del y # noqa: F821