From 2eff9c29a11a9549121c63a702315cfe6c4a711f Mon Sep 17 00:00:00 2001 From: Rami Ali Date: Tue, 22 Nov 2016 15:49:02 +1100 Subject: [PATCH] tests/basics: Improve user class coverage. --- tests/basics/class_item.py | 9 +++++++++ tests/basics/class_misc.py | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/basics/class_misc.py 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')