diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-08 17:48:44 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-08 17:48:44 +0000 |
commit | c33ecb83ba4bc388cd773eec827dc0b85505dce7 (patch) | |
tree | eaeaea4bc4fd868808df84fad55812866b32b6ab /tests/basics | |
parent | 5b7aa294e02c792984750546ca118eeb7ba48b59 (diff) | |
download | micropython-c33ecb83ba4bc388cd773eec827dc0b85505dce7.tar.gz micropython-c33ecb83ba4bc388cd773eec827dc0b85505dce7.zip |
tests: Add test for when instance member overrides class member.
Diffstat (limited to 'tests/basics')
-rw-r--r-- | tests/basics/class_instance_override.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/class_instance_override.py b/tests/basics/class_instance_override.py new file mode 100644 index 0000000000..6afbcd9428 --- /dev/null +++ b/tests/basics/class_instance_override.py @@ -0,0 +1,10 @@ +# test that we can override a class method with an instance method + +class A: + def foo(self): + return 1 + +a = A() +print(a.foo()) +a.foo = lambda:2 +print(a.foo()) |