mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
26 lines
478 B
Python
26 lines
478 B
Python
from testutils import assert_raises
|
|
|
|
|
|
class A(dict):
|
|
def a():
|
|
pass
|
|
|
|
def b():
|
|
pass
|
|
|
|
|
|
assert A.__dict__["a"] == A.a
|
|
with assert_raises(KeyError) as cm:
|
|
A.__dict__["not here"]
|
|
|
|
assert cm.exception.args[0] == "not here"
|
|
|
|
assert "b" in A.__dict__
|
|
assert "c" not in A.__dict__
|
|
|
|
assert "__dict__" in A.__dict__
|
|
|
|
assert A.__dict__.get("not here", "default") == "default"
|
|
assert A.__dict__.get("a", "default") is A.a
|
|
assert A.__dict__.get("not here") is None
|