summaryrefslogtreecommitdiff
path: root/tests/basics/self_type_check.py
blob: 206678e25d1bfd51eadedeb2aab9107d89a351bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# make sure type of first arg (self) to a builtin method is checked
import skip_if
skip_if.board_in("gemma_m0", "trinket_m0")

list.append

try:
    list.append()
except TypeError as e:
    print("TypeError")

try:
    list.append(1)
except TypeError as e:
    print("TypeError")

try:
    list.append(1, 2)
except TypeError as e:
    print("TypeError")

l = []
list.append(l, 2)
print(l)

try:
    getattr(list, "append")(1, 2)
except TypeError as e:
    print("TypeError")

l = []
getattr(list, "append")(l, 2)
print(l)