Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_funcattrs.ArbitraryFunctionAttrTest Class Reference
Inheritance diagram for test.test_funcattrs.ArbitraryFunctionAttrTest:
Inheritance graph
[legend]
Collaboration diagram for test.test_funcattrs.ArbitraryFunctionAttrTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_set_attr
def test_delete_unknown_attr
def test_unset_attr
def setUp
def cannot_set_attr

Public Attributes

 fi
 F
 b

Detailed Description

Definition at line 187 of file test_funcattrs.py.


Member Function Documentation

def test.test_funcattrs.FuncAttrsTest.cannot_set_attr (   self,
  obj,
  name,
  value,
  exceptions 
) [inherited]

Definition at line 16 of file test_funcattrs.py.

00016 
00017     def cannot_set_attr(self, obj, name, value, exceptions):
00018         try:
00019             setattr(obj, name, value)
00020         except exceptions:
00021             pass
00022         else:
00023             self.fail("shouldn't be able to set %s to %r" % (name, value))
00024         try:
00025             delattr(obj, name)
00026         except exceptions:
00027             pass
00028         else:
00029             self.fail("shouldn't be able to del %s" % name)
00030 

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_funcattrs.FuncAttrsTest.setUp (   self) [inherited]

Definition at line 6 of file test_funcattrs.py.

00006 
00007     def setUp(self):
00008         class F:
00009             def a(self):
00010                 pass
00011         def b():
00012             return 3
00013         self.fi = F()
00014         self.F = F
00015         self.b = b

Here is the caller graph for this function:

Definition at line 198 of file test_funcattrs.py.

00198 
00199     def test_delete_unknown_attr(self):
00200         try:
00201             del self.b.unknown_attr
00202         except AttributeError:
00203             pass
00204         else:
00205             self.fail("deleting unknown attribute should raise TypeError")

Here is the call graph for this function:

Definition at line 188 of file test_funcattrs.py.

00188 
00189     def test_set_attr(self):
00190         self.b.known_attr = 7
00191         self.assertEqual(self.b.known_attr, 7)
00192         try:
00193             self.fi.a.known_attr = 7
00194         except AttributeError:
00195             pass
00196         else:
00197             self.fail("setting attributes on methods should raise error")

Here is the call graph for this function:

Definition at line 206 of file test_funcattrs.py.

00206 
00207     def test_unset_attr(self):
00208         for func in [self.b, self.fi.a]:
00209             try:
00210                 func.non_existent_attr
00211             except AttributeError:
00212                 pass
00213             else:
00214                 self.fail("using unknown attributes should raise "
00215                           "AttributeError")
00216 

Here is the call graph for this function:


Member Data Documentation

Definition at line 14 of file test_funcattrs.py.

Definition at line 13 of file test_funcattrs.py.

Definition at line 12 of file test_funcattrs.py.


The documentation for this class was generated from the following file: