circuitpython/tests/basics/class_descriptor.py
Paul Sokolovsky da34b6ef45 tests: Fix few test for proper "skipped" detection with qemu-arm's tinytest.
"Builtin" tinytest-based testsuite as employed by qemu-arm (and now
generalized by me to be reusable for other targets) performs simplified
detection of skipped tests, it treats as such tests which raised SystemExit
(instead of checking got "SKIP" output). Consequently, each "SKIP" must
be accompanied by SystemExit (and conversely, SystemExit should not be
used if test is not skipped, which so far seems to be true).
2017-12-12 23:45:48 +02:00

35 lines
619 B
Python

class Descriptor:
def __get__(self, obj, cls):
print('get')
print(type(obj) is Main)
print(cls is Main)
return 'result'
def __set__(self, obj, val):
print('set')
print(type(obj) is Main)
print(val)
def __delete__(self, obj):
print('delete')
print(type(obj) is Main)
class Main:
Forward = Descriptor()
m = Main()
try:
m.__class__
except AttributeError:
print("SKIP")
raise SystemExit
r = m.Forward
if 'Descriptor' in repr(r.__class__):
print('SKIP')
raise SystemExit
print(r)
m.Forward = 'a'
del m.Forward