Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_descrtut Namespace Reference

Classes

class  defaultdict
class  defaultdict2
class  A
class  B
class  C
class  D

Functions

def test_main

Variables

string test_1
string test_2
string test_3
string test_4
string test_5
string test_6
string test_7
string test_8
dictionary __test__

Function Documentation

def test.test_descrtut.test_main (   verbose = None)

Definition at line 471 of file test_descrtut.py.

00471 
00472 def test_main(verbose=None):
00473     # Obscure:  import this module as test.test_descrtut instead of as
00474     # plain test_descrtut because the name of this module works its way
00475     # into the doctest examples, and unless the full test.test_descrtut
00476     # business is used the name can change depending on how the test is
00477     # invoked.
00478     from test import support, test_descrtut
00479     support.run_doctest(test_descrtut, verbose)
00480 
# This part isn't needed for regrtest, but for running the test directly.

Variable Documentation

Initial value:
00001 {"tut1": test_1,
00002             "tut2": test_2,
00003             "tut3": test_3,
00004             "tut4": test_4,
00005             "tut5": test_5,
00006             "tut6": test_6,
00007             "tut7": test_7,
00008             "tut8": test_8}

Definition at line 458 of file test_descrtut.py.

Definition at line 35 of file test_descrtut.py.

Initial value:
00001 """
00002 
00003 The __slots__ declaration takes a list of instance variables, and reserves
00004 space for exactly these in the instance. When __slots__ is used, other
00005 instance variables cannot be assigned to:
00006 
00007     >>> a = defaultdict2(default=0.0)
00008     >>> a[1]
00009     0.0
00010     >>> a.default = -1
00011     >>> a[1]
00012     -1
00013     >>> a.x1 = 1
00014     Traceback (most recent call last):
00015       File "<stdin>", line 1, in ?
00016     AttributeError: 'defaultdict2' object has no attribute 'x1'
00017     >>>
00018 
00019 """

Definition at line 125 of file test_descrtut.py.

Definition at line 145 of file test_descrtut.py.

Definition at line 229 of file test_descrtut.py.

Definition at line 299 of file test_descrtut.py.

Definition at line 373 of file test_descrtut.py.

Initial value:
00001 """
00002 
00003 Cooperative methods and "super"
00004 
00005 >>> print(D().m()) # "DCBA"
00006 DCBA
00007 """

Definition at line 425 of file test_descrtut.py.

Initial value:
00001 """
00002 
00003 Backwards incompatibilities
00004 
00005 >>> class A:
00006 ...     def foo(self):
00007 ...         print("called A.foo()")
00008 
00009 >>> class B(A):
00010 ...     pass
00011 
00012 >>> class C(A):
00013 ...     def foo(self):
00014 ...         B.foo(self)
00015 
00016 >>> C().foo()
00017 called A.foo()
00018 
00019 >>> class C(A):
00020 ...     def foo(self):
00021 ...         A.foo(self)
00022 >>> C().foo()
00023 called A.foo()
00024 """

Definition at line 433 of file test_descrtut.py.