2013-03-20 | Paul Boddie | raw files shortlog changelog graph | Added tests of literal constant attribute access and indirect __class__ access on classes. | syspython-as-target |
tests/attribute_access_constant_direct.py (file) tests/class_class_attr_indirect_in_function.py (file) |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/attribute_access_constant_direct.py Wed Mar 20 00:05:37 2013 +0100 1.3 @@ -0,0 +1,7 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +f1 = "Hello".__len__ 1.7 + 1.8 +result1_5 = f1() 1.9 + 1.10 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tests/class_class_attr_indirect_in_function.py Wed Mar 20 00:05:37 2013 +0100 2.3 @@ -0,0 +1,23 @@ 2.4 +#!/usr/bin/env python 2.5 + 2.6 +class A: 2.7 + pass 2.8 + 2.9 +class B(A): 2.10 + pass 2.11 + 2.12 +class C: 2.13 + pass 2.14 + 2.15 +def f(x): 2.16 + return x.__class__ 2.17 + 2.18 +a = f(A) 2.19 +b = f(B) 2.20 +c = f(C) 2.21 + 2.22 +result_1 = a is type and 1 or 0 2.23 +result_2 = b is type and 2 or 0 2.24 +result_3 = c is type and 3 or 0 2.25 + 2.26 +# vim: tabstop=4 expandtab shiftwidth=4