micropython

Annotated tests/isinstance.py

795:e2792f749a13
2014-03-17 Paul Boddie Added a note about the _attr annotation and unresolved names. syspython-as-target
paul@404 1
#!/usr/bin/env python
paul@404 2
paul@404 3
result_1 = 0
paul@404 4
result_2 = 0
paul@404 5
result_3 = 0
paul@404 6
result_4 = 0
paul@404 7
result_5 = 0
paul@404 8
result_6 = 0
paul@404 9
paul@404 10
if isinstance(1, int):
paul@404 11
    result_1 = 1
paul@404 12
paul@404 13
if isinstance("", str):
paul@404 14
    result_2 = 2
paul@404 15
paul@404 16
if isinstance((1, 2, 3), tuple):
paul@404 17
    result_3 = 3
paul@404 18
paul@404 19
if isinstance((1, 2, 3), (int, tuple)):
paul@404 20
    result_4 = 4
paul@404 21
paul@404 22
if not isinstance(1, (str, tuple)):
paul@404 23
    result_5 = 5
paul@404 24
paul@404 25
if isinstance(tuple, type):
paul@404 26
    result_6 = 6
paul@404 27
paul@404 28
# vim: tabstop=4 expandtab shiftwidth=4