1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-02-05 08:08:23 +08:00

Add getattr() and callMethod() tests to test_wrapped

This commit is contained in:
Thomas Perl 2014-10-08 13:00:08 +02:00
parent cc7bc11595
commit 4619b95040
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,10 @@ class Foo(object):
def __init__(self, name):
print('new Foo(', name, ')')
self.name = name
self.bar = 4711
def methodman(self, something):
return 'I came to bring {}'.format(something)
def __del__(self):
print('__del__ called on', self.name)

View File

@ -16,6 +16,12 @@ Rectangle {
var foo = call_sync('test_wrapped.get_foo', []);
console.log('got foo: ' + foo);
console.log('attribute bar of foo: ' + getattr(foo, 'bar'));
callMethod(foo, 'methodman', ['the pain'], function (result) {
console.log('methodman() result: ' + result);
});
var result = call_sync('test_wrapped.set_foo', [foo]);
console.log('got result: ' + result);
});