Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
test.test_fractions.DummyFloat Class Reference
Inheritance diagram for test.test_fractions.DummyFloat:
Inheritance graph
[legend]
Collaboration diagram for test.test_fractions.DummyFloat:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __eq__
def __le__
def __lt__
def __ge__
def __gt__
def __float__
def __sub__

Public Attributes

 value
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _richcmp

Static Private Attributes

 __rsub__ = __sub__

Detailed Description

Dummy float class for testing comparisons with Fractions

Definition at line 15 of file test_fractions.py.


Constructor & Destructor Documentation

def test.test_fractions.DummyFloat.__init__ (   self,
  value 
)

Definition at line 18 of file test_fractions.py.

00018 
00019     def __init__(self, value):
00020         if not isinstance(value, float):
00021             raise TypeError("DummyFloat can only be initialized from float")
00022         self.value = value

Here is the caller graph for this function:


Member Function Documentation

def test.test_fractions.DummyFloat.__eq__ (   self,
  other 
)

Definition at line 31 of file test_fractions.py.

00031 
    def __eq__(self, other): return self._richcmp(other, operator.eq)

Here is the call graph for this function:

Definition at line 38 of file test_fractions.py.

00038 
00039     def __float__(self):
00040         assert False, "__float__ should not be invoked for comparisons"

def test.test_fractions.DummyFloat.__ge__ (   self,
  other 
)

Definition at line 34 of file test_fractions.py.

00034 
    def __ge__(self, other): return self._richcmp(other, operator.ge)

Here is the call graph for this function:

def test.test_fractions.DummyFloat.__gt__ (   self,
  other 
)

Definition at line 35 of file test_fractions.py.

00035 
00036     def __gt__(self, other): return self._richcmp(other, operator.gt)

Here is the call graph for this function:

def test.test_fractions.DummyFloat.__le__ (   self,
  other 
)

Definition at line 32 of file test_fractions.py.

00032 
    def __le__(self, other): return self._richcmp(other, operator.le)

Here is the call graph for this function:

def test.test_fractions.DummyFloat.__lt__ (   self,
  other 
)

Definition at line 33 of file test_fractions.py.

00033 
    def __lt__(self, other): return self._richcmp(other, operator.lt)

Here is the call graph for this function:

def test.test_fractions.DummyFloat.__sub__ (   self,
  other 
)

Definition at line 42 of file test_fractions.py.

00042 
00043     def __sub__(self, other):
        assert False, "__sub__ should not be invoked for comparisons"
def test.test_fractions.DummyFloat._richcmp (   self,
  other,
  op 
) [private]

Definition at line 23 of file test_fractions.py.

00023 
00024     def _richcmp(self, other, op):
00025         if isinstance(other, numbers.Rational):
00026             return op(F.from_float(self.value), other)
00027         elif isinstance(other, DummyFloat):
00028             return op(self.value, other.value)
00029         else:
00030             return NotImplemented

Here is the caller graph for this function:


Member Data Documentation

Definition at line 44 of file test_fractions.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 21 of file test_fractions.py.


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