diff options
author | Rami Ali <flowergrass@users.noreply.github.com> | 2016-11-22 15:49:02 +1100 |
---|---|---|
committer | Rami Ali <flowergrass@users.noreply.github.com> | 2016-11-22 15:49:02 +1100 |
commit | 2eff9c29a11a9549121c63a702315cfe6c4a711f (patch) | |
tree | a61026296ec0f5659dc0cd9c6a685ed62340790a /tests | |
parent | 1b41cacac717ca2cb5027626b1521777e0bdcf83 (diff) | |
download | micropython-2eff9c29a11a9549121c63a702315cfe6c4a711f.tar.gz micropython-2eff9c29a11a9549121c63a702315cfe6c4a711f.zip |
tests/basics: Improve user class coverage.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/class_item.py | 9 | ||||
-rw-r--r-- | tests/basics/class_misc.py | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/class_item.py b/tests/basics/class_item.py index a96817462f..1d9488bde1 100644 --- a/tests/basics/class_item.py +++ b/tests/basics/class_item.py @@ -15,3 +15,12 @@ c = C() print(c[1]) c[1] = 2 del c[3] + +# index not supported +class A: + pass +a = A() +try: + a[1] +except TypeError: + print('TypeError') diff --git a/tests/basics/class_misc.py b/tests/basics/class_misc.py new file mode 100644 index 0000000000..82b9b3479e --- /dev/null +++ b/tests/basics/class_misc.py @@ -0,0 +1,9 @@ +# converting user instance to buffer +class C: + pass + +c = C() +try: + d = bytearray(c) +except TypeError: + print('TypeError') |