Back to index

python3.2  3.2.2
Public Member Functions
test.test_abstract_numbers.TestNumbers Class Reference

List of all members.

Public Member Functions

def test_int
def test_float
def test_complex

Detailed Description

Definition at line 9 of file test_abstract_numbers.py.


Member Function Documentation

Definition at line 28 of file test_abstract_numbers.py.

00028 
00029     def test_complex(self):
00030         self.assertFalse(issubclass(complex, Real))
00031         self.assertTrue(issubclass(complex, Complex))
00032 
00033         c1, c2 = complex(3, 2), complex(4,1)
00034         # XXX: This is not ideal, but see the comment in math_trunc().
00035         self.assertRaises(TypeError, math.trunc, c1)
00036         self.assertRaises(TypeError, operator.mod, c1, c2)
00037         self.assertRaises(TypeError, divmod, c1, c2)
00038         self.assertRaises(TypeError, operator.floordiv, c1, c2)
00039         self.assertRaises(TypeError, float, c1)
00040         self.assertRaises(TypeError, int, c1)

Here is the call graph for this function:

Definition at line 20 of file test_abstract_numbers.py.

00020 
00021     def test_float(self):
00022         self.assertFalse(issubclass(float, Rational))
00023         self.assertTrue(issubclass(float, Real))
00024 
00025         self.assertEqual(7.3, float(7.3).real)
00026         self.assertEqual(0, float(7.3).imag)
00027         self.assertEqual(7.3, float(7.3).conjugate())

Here is the call graph for this function:

Definition at line 10 of file test_abstract_numbers.py.

00010 
00011     def test_int(self):
00012         self.assertTrue(issubclass(int, Integral))
00013         self.assertTrue(issubclass(int, Complex))
00014 
00015         self.assertEqual(7, int(7).real)
00016         self.assertEqual(0, int(7).imag)
00017         self.assertEqual(7, int(7).conjugate())
00018         self.assertEqual(7, int(7).numerator)
00019         self.assertEqual(1, int(7).denominator)

Here is the call graph for this function:


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