Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions
eiffel.Tests Class Reference

List of all members.

Public Member Functions

def testEiffelMetaClass1
def testEiffelMetaClass2

Private Member Functions

def _test

Detailed Description

Definition at line 99 of file eiffel.py.


Member Function Documentation

def eiffel.Tests._test (   self,
  metaclass 
) [private]

Definition at line 107 of file eiffel.py.

00107 
00108     def _test(self, metaclass):
00109         class Eiffel(metaclass=metaclass):
00110             pass
00111 
00112         class Test(Eiffel):
00113             def m(self, arg):
00114                 """Make it a little larger"""
00115                 return arg + 1
00116 
00117             def m2(self, arg):
00118                 """Make it a little larger"""
00119                 return arg + 1
00120 
00121             def m2_pre(self, arg):
00122                 assert arg > 0
00123 
00124             def m2_post(self, result, arg):
00125                 assert result > arg
00126 
00127         class Sub(Test):
00128             def m2(self, arg):
00129                 return arg**2
00130 
00131             def m2_post(self, Result, arg):
00132                 super(Sub, self).m2_post(Result, arg)
00133                 assert Result < 100
00134 
00135         t = Test()
00136         self.assertEqual(t.m(1), 2)
00137         self.assertEqual(t.m2(1), 2)
00138         self.assertRaises(AssertionError, t.m2, 0)
00139 
00140         s = Sub()
00141         self.assertRaises(AssertionError, s.m2, 1)
00142         self.assertRaises(AssertionError, s.m2, 10)
00143         self.assertEqual(s.m2(5), 25)
00144 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 101 of file eiffel.py.

00101 
00102     def testEiffelMetaClass1(self):
00103         self._test(EiffelMetaClass1)

Here is the call graph for this function:

Definition at line 104 of file eiffel.py.

00104 
00105     def testEiffelMetaClass2(self):
00106         self._test(EiffelMetaClass2)

Here is the call graph for this function:


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