Back to index

python3.2  3.2.2
Public Member Functions
test.test_decimal.ContextAPItests Class Reference

List of all members.

Public Member Functions

def test_pickle
def test_equality_with_other_types
def test_copy
def test__clamp
def test_abs
def test_add
def test_compare
def test_compare_signal
def test_compare_total
def test_compare_total_mag
def test_copy_abs
def test_copy_decimal
def test_copy_negate
def test_copy_sign
def test_divide
def test_divide_int
def test_divmod
def test_exp
def test_fma
def test_is_finite
def test_is_infinite
def test_is_nan
def test_is_normal
def test_is_qnan
def test_is_signed
def test_is_snan
def test_is_subnormal
def test_is_zero
def test_ln
def test_log10
def test_logb
def test_logical_and
def test_logical_invert
def test_logical_or
def test_logical_xor
def test_max
def test_max_mag
def test_min
def test_min_mag
def test_minus
def test_multiply
def test_next_minus
def test_next_plus
def test_next_toward
def test_normalize
def test_number_class
def test_power
def test_plus
def test_quantize
def test_remainder
def test_remainder_near
def test_rotate
def test_sqrt
def test_same_quantum
def test_scaleb
def test_shift
def test_subtract
def test_to_eng_string
def test_to_sci_string
def test_to_integral_exact
def test_to_integral_value

Detailed Description

Definition at line 1808 of file test_decimal.py.


Member Function Documentation

Definition at line 1830 of file test_decimal.py.

01830 
01831     def test__clamp(self):
01832         # In Python 3.2, the private attribute `_clamp` was made
01833         # public (issue 8540), with the old `_clamp` becoming a
01834         # property wrapping `clamp`.  For the duration of Python 3.2
01835         # only, the attribute should be gettable/settable via both
01836         # `clamp` and `_clamp`; in Python 3.3, `_clamp` should be
01837         # removed.
01838         c = Context(clamp = 0)
01839         self.assertEqual(c.clamp, 0)
01840 
01841         with check_warnings(("", DeprecationWarning)):
01842             c._clamp = 1
01843         self.assertEqual(c.clamp, 1)
01844         with check_warnings(("", DeprecationWarning)):
01845             self.assertEqual(c._clamp, 1)
01846         c.clamp = 0
01847         self.assertEqual(c.clamp, 0)
01848         with check_warnings(("", DeprecationWarning)):
01849             self.assertEqual(c._clamp, 0)

Here is the call graph for this function:

Definition at line 1850 of file test_decimal.py.

01850 
01851     def test_abs(self):
01852         c = Context()
01853         d = c.abs(Decimal(-1))
01854         self.assertEqual(c.abs(-1), d)
01855         self.assertRaises(TypeError, c.abs, '-1')

Here is the call graph for this function:

Definition at line 1856 of file test_decimal.py.

01856 
01857     def test_add(self):
01858         c = Context()
01859         d = c.add(Decimal(1), Decimal(1))
01860         self.assertEqual(c.add(1, 1), d)
01861         self.assertEqual(c.add(Decimal(1), 1), d)
01862         self.assertEqual(c.add(1, Decimal(1)), d)
01863         self.assertRaises(TypeError, c.add, '1', 1)
01864         self.assertRaises(TypeError, c.add, 1, '1')

Here is the call graph for this function:

Definition at line 1865 of file test_decimal.py.

01865 
01866     def test_compare(self):
01867         c = Context()
01868         d = c.compare(Decimal(1), Decimal(1))
01869         self.assertEqual(c.compare(1, 1), d)
01870         self.assertEqual(c.compare(Decimal(1), 1), d)
01871         self.assertEqual(c.compare(1, Decimal(1)), d)
01872         self.assertRaises(TypeError, c.compare, '1', 1)
01873         self.assertRaises(TypeError, c.compare, 1, '1')

Here is the call graph for this function:

Definition at line 1874 of file test_decimal.py.

01874 
01875     def test_compare_signal(self):
01876         c = Context()
01877         d = c.compare_signal(Decimal(1), Decimal(1))
01878         self.assertEqual(c.compare_signal(1, 1), d)
01879         self.assertEqual(c.compare_signal(Decimal(1), 1), d)
01880         self.assertEqual(c.compare_signal(1, Decimal(1)), d)
01881         self.assertRaises(TypeError, c.compare_signal, '1', 1)
01882         self.assertRaises(TypeError, c.compare_signal, 1, '1')

Here is the call graph for this function:

Definition at line 1883 of file test_decimal.py.

01883 
01884     def test_compare_total(self):
01885         c = Context()
01886         d = c.compare_total(Decimal(1), Decimal(1))
01887         self.assertEqual(c.compare_total(1, 1), d)
01888         self.assertEqual(c.compare_total(Decimal(1), 1), d)
01889         self.assertEqual(c.compare_total(1, Decimal(1)), d)
01890         self.assertRaises(TypeError, c.compare_total, '1', 1)
01891         self.assertRaises(TypeError, c.compare_total, 1, '1')

Here is the call graph for this function:

Definition at line 1892 of file test_decimal.py.

01892 
01893     def test_compare_total_mag(self):
01894         c = Context()
01895         d = c.compare_total_mag(Decimal(1), Decimal(1))
01896         self.assertEqual(c.compare_total_mag(1, 1), d)
01897         self.assertEqual(c.compare_total_mag(Decimal(1), 1), d)
01898         self.assertEqual(c.compare_total_mag(1, Decimal(1)), d)
01899         self.assertRaises(TypeError, c.compare_total_mag, '1', 1)
01900         self.assertRaises(TypeError, c.compare_total_mag, 1, '1')

Here is the call graph for this function:

Definition at line 1822 of file test_decimal.py.

01822 
01823     def test_copy(self):
01824         # All copies should be deep
01825         c = Context()
01826         d = c.copy()
01827         self.assertNotEqual(id(c), id(d))
01828         self.assertNotEqual(id(c.flags), id(d.flags))
01829         self.assertNotEqual(id(c.traps), id(d.traps))

Here is the call graph for this function:

Definition at line 1901 of file test_decimal.py.

01901 
01902     def test_copy_abs(self):
01903         c = Context()
01904         d = c.copy_abs(Decimal(-1))
01905         self.assertEqual(c.copy_abs(-1), d)
01906         self.assertRaises(TypeError, c.copy_abs, '-1')

Here is the call graph for this function:

Definition at line 1907 of file test_decimal.py.

01907 
01908     def test_copy_decimal(self):
01909         c = Context()
01910         d = c.copy_decimal(Decimal(-1))
01911         self.assertEqual(c.copy_decimal(-1), d)
01912         self.assertRaises(TypeError, c.copy_decimal, '-1')

Here is the call graph for this function:

Definition at line 1913 of file test_decimal.py.

01913 
01914     def test_copy_negate(self):
01915         c = Context()
01916         d = c.copy_negate(Decimal(-1))
01917         self.assertEqual(c.copy_negate(-1), d)
01918         self.assertRaises(TypeError, c.copy_negate, '-1')

Here is the call graph for this function:

Definition at line 1919 of file test_decimal.py.

01919 
01920     def test_copy_sign(self):
01921         c = Context()
01922         d = c.copy_sign(Decimal(1), Decimal(-2))
01923         self.assertEqual(c.copy_sign(1, -2), d)
01924         self.assertEqual(c.copy_sign(Decimal(1), -2), d)
01925         self.assertEqual(c.copy_sign(1, Decimal(-2)), d)
01926         self.assertRaises(TypeError, c.copy_sign, '1', -2)
01927         self.assertRaises(TypeError, c.copy_sign, 1, '-2')

Here is the call graph for this function:

Definition at line 1928 of file test_decimal.py.

01928 
01929     def test_divide(self):
01930         c = Context()
01931         d = c.divide(Decimal(1), Decimal(2))
01932         self.assertEqual(c.divide(1, 2), d)
01933         self.assertEqual(c.divide(Decimal(1), 2), d)
01934         self.assertEqual(c.divide(1, Decimal(2)), d)
01935         self.assertRaises(TypeError, c.divide, '1', 2)
01936         self.assertRaises(TypeError, c.divide, 1, '2')

Here is the call graph for this function:

Definition at line 1937 of file test_decimal.py.

01937 
01938     def test_divide_int(self):
01939         c = Context()
01940         d = c.divide_int(Decimal(1), Decimal(2))
01941         self.assertEqual(c.divide_int(1, 2), d)
01942         self.assertEqual(c.divide_int(Decimal(1), 2), d)
01943         self.assertEqual(c.divide_int(1, Decimal(2)), d)
01944         self.assertRaises(TypeError, c.divide_int, '1', 2)
01945         self.assertRaises(TypeError, c.divide_int, 1, '2')

Here is the call graph for this function:

Definition at line 1946 of file test_decimal.py.

01946 
01947     def test_divmod(self):
01948         c = Context()
01949         d = c.divmod(Decimal(1), Decimal(2))
01950         self.assertEqual(c.divmod(1, 2), d)
01951         self.assertEqual(c.divmod(Decimal(1), 2), d)
01952         self.assertEqual(c.divmod(1, Decimal(2)), d)
01953         self.assertRaises(TypeError, c.divmod, '1', 2)
01954         self.assertRaises(TypeError, c.divmod, 1, '2')

Here is the call graph for this function:

Definition at line 1818 of file test_decimal.py.

01818 
01819     def test_equality_with_other_types(self):
01820         self.assertIn(Decimal(10), ['a', 1.0, Decimal(10), (1,2), {}])
01821         self.assertNotIn(Decimal(10), ['a', 1.0, (1,2), {}])

Here is the call graph for this function:

Definition at line 1955 of file test_decimal.py.

01955 
01956     def test_exp(self):
01957         c = Context()
01958         d = c.exp(Decimal(10))
01959         self.assertEqual(c.exp(10), d)
01960         self.assertRaises(TypeError, c.exp, '10')

Here is the call graph for this function:

Definition at line 1961 of file test_decimal.py.

01961 
01962     def test_fma(self):
01963         c = Context()
01964         d = c.fma(Decimal(2), Decimal(3), Decimal(4))
01965         self.assertEqual(c.fma(2, 3, 4), d)
01966         self.assertEqual(c.fma(Decimal(2), 3, 4), d)
01967         self.assertEqual(c.fma(2, Decimal(3), 4), d)
01968         self.assertEqual(c.fma(2, 3, Decimal(4)), d)
01969         self.assertEqual(c.fma(Decimal(2), Decimal(3), 4), d)
01970         self.assertRaises(TypeError, c.fma, '2', 3, 4)
01971         self.assertRaises(TypeError, c.fma, 2, '3', 4)
01972         self.assertRaises(TypeError, c.fma, 2, 3, '4')

Here is the call graph for this function:

Definition at line 1973 of file test_decimal.py.

01973 
01974     def test_is_finite(self):
01975         c = Context()
01976         d = c.is_finite(Decimal(10))
01977         self.assertEqual(c.is_finite(10), d)
01978         self.assertRaises(TypeError, c.is_finite, '10')

Here is the call graph for this function:

Definition at line 1979 of file test_decimal.py.

01979 
01980     def test_is_infinite(self):
01981         c = Context()
01982         d = c.is_infinite(Decimal(10))
01983         self.assertEqual(c.is_infinite(10), d)
01984         self.assertRaises(TypeError, c.is_infinite, '10')

Here is the call graph for this function:

Definition at line 1985 of file test_decimal.py.

01985 
01986     def test_is_nan(self):
01987         c = Context()
01988         d = c.is_nan(Decimal(10))
01989         self.assertEqual(c.is_nan(10), d)
01990         self.assertRaises(TypeError, c.is_nan, '10')

Here is the call graph for this function:

Definition at line 1991 of file test_decimal.py.

01991 
01992     def test_is_normal(self):
01993         c = Context()
01994         d = c.is_normal(Decimal(10))
01995         self.assertEqual(c.is_normal(10), d)
01996         self.assertRaises(TypeError, c.is_normal, '10')

Here is the call graph for this function:

Definition at line 1997 of file test_decimal.py.

01997 
01998     def test_is_qnan(self):
01999         c = Context()
02000         d = c.is_qnan(Decimal(10))
02001         self.assertEqual(c.is_qnan(10), d)
02002         self.assertRaises(TypeError, c.is_qnan, '10')

Here is the call graph for this function:

Definition at line 2003 of file test_decimal.py.

02003 
02004     def test_is_signed(self):
02005         c = Context()
02006         d = c.is_signed(Decimal(10))
02007         self.assertEqual(c.is_signed(10), d)
02008         self.assertRaises(TypeError, c.is_signed, '10')

Here is the call graph for this function:

Definition at line 2009 of file test_decimal.py.

02009 
02010     def test_is_snan(self):
02011         c = Context()
02012         d = c.is_snan(Decimal(10))
02013         self.assertEqual(c.is_snan(10), d)
02014         self.assertRaises(TypeError, c.is_snan, '10')

Here is the call graph for this function:

Definition at line 2015 of file test_decimal.py.

02015 
02016     def test_is_subnormal(self):
02017         c = Context()
02018         d = c.is_subnormal(Decimal(10))
02019         self.assertEqual(c.is_subnormal(10), d)
02020         self.assertRaises(TypeError, c.is_subnormal, '10')

Here is the call graph for this function:

Definition at line 2021 of file test_decimal.py.

02021 
02022     def test_is_zero(self):
02023         c = Context()
02024         d = c.is_zero(Decimal(10))
02025         self.assertEqual(c.is_zero(10), d)
02026         self.assertRaises(TypeError, c.is_zero, '10')

Here is the call graph for this function:

Definition at line 2027 of file test_decimal.py.

02027 
02028     def test_ln(self):
02029         c = Context()
02030         d = c.ln(Decimal(10))
02031         self.assertEqual(c.ln(10), d)
02032         self.assertRaises(TypeError, c.ln, '10')

Here is the call graph for this function:

Definition at line 2033 of file test_decimal.py.

02033 
02034     def test_log10(self):
02035         c = Context()
02036         d = c.log10(Decimal(10))
02037         self.assertEqual(c.log10(10), d)
02038         self.assertRaises(TypeError, c.log10, '10')

Here is the call graph for this function:

Definition at line 2039 of file test_decimal.py.

02039 
02040     def test_logb(self):
02041         c = Context()
02042         d = c.logb(Decimal(10))
02043         self.assertEqual(c.logb(10), d)
02044         self.assertRaises(TypeError, c.logb, '10')

Here is the call graph for this function:

Definition at line 2045 of file test_decimal.py.

02045 
02046     def test_logical_and(self):
02047         c = Context()
02048         d = c.logical_and(Decimal(1), Decimal(1))
02049         self.assertEqual(c.logical_and(1, 1), d)
02050         self.assertEqual(c.logical_and(Decimal(1), 1), d)
02051         self.assertEqual(c.logical_and(1, Decimal(1)), d)
02052         self.assertRaises(TypeError, c.logical_and, '1', 1)
02053         self.assertRaises(TypeError, c.logical_and, 1, '1')

Here is the call graph for this function:

Definition at line 2054 of file test_decimal.py.

02054 
02055     def test_logical_invert(self):
02056         c = Context()
02057         d = c.logical_invert(Decimal(1000))
02058         self.assertEqual(c.logical_invert(1000), d)
02059         self.assertRaises(TypeError, c.logical_invert, '1000')

Here is the call graph for this function:

Definition at line 2060 of file test_decimal.py.

02060 
02061     def test_logical_or(self):
02062         c = Context()
02063         d = c.logical_or(Decimal(1), Decimal(1))
02064         self.assertEqual(c.logical_or(1, 1), d)
02065         self.assertEqual(c.logical_or(Decimal(1), 1), d)
02066         self.assertEqual(c.logical_or(1, Decimal(1)), d)
02067         self.assertRaises(TypeError, c.logical_or, '1', 1)
02068         self.assertRaises(TypeError, c.logical_or, 1, '1')

Here is the call graph for this function:

Definition at line 2069 of file test_decimal.py.

02069 
02070     def test_logical_xor(self):
02071         c = Context()
02072         d = c.logical_xor(Decimal(1), Decimal(1))
02073         self.assertEqual(c.logical_xor(1, 1), d)
02074         self.assertEqual(c.logical_xor(Decimal(1), 1), d)
02075         self.assertEqual(c.logical_xor(1, Decimal(1)), d)
02076         self.assertRaises(TypeError, c.logical_xor, '1', 1)
02077         self.assertRaises(TypeError, c.logical_xor, 1, '1')

Here is the call graph for this function:

Definition at line 2078 of file test_decimal.py.

02078 
02079     def test_max(self):
02080         c = Context()
02081         d = c.max(Decimal(1), Decimal(2))
02082         self.assertEqual(c.max(1, 2), d)
02083         self.assertEqual(c.max(Decimal(1), 2), d)
02084         self.assertEqual(c.max(1, Decimal(2)), d)
02085         self.assertRaises(TypeError, c.max, '1', 2)
02086         self.assertRaises(TypeError, c.max, 1, '2')

Here is the call graph for this function:

Definition at line 2087 of file test_decimal.py.

02087 
02088     def test_max_mag(self):
02089         c = Context()
02090         d = c.max_mag(Decimal(1), Decimal(2))
02091         self.assertEqual(c.max_mag(1, 2), d)
02092         self.assertEqual(c.max_mag(Decimal(1), 2), d)
02093         self.assertEqual(c.max_mag(1, Decimal(2)), d)
02094         self.assertRaises(TypeError, c.max_mag, '1', 2)
02095         self.assertRaises(TypeError, c.max_mag, 1, '2')

Here is the call graph for this function:

Definition at line 2096 of file test_decimal.py.

02096 
02097     def test_min(self):
02098         c = Context()
02099         d = c.min(Decimal(1), Decimal(2))
02100         self.assertEqual(c.min(1, 2), d)
02101         self.assertEqual(c.min(Decimal(1), 2), d)
02102         self.assertEqual(c.min(1, Decimal(2)), d)
02103         self.assertRaises(TypeError, c.min, '1', 2)
02104         self.assertRaises(TypeError, c.min, 1, '2')

Here is the call graph for this function:

Definition at line 2105 of file test_decimal.py.

02105 
02106     def test_min_mag(self):
02107         c = Context()
02108         d = c.min_mag(Decimal(1), Decimal(2))
02109         self.assertEqual(c.min_mag(1, 2), d)
02110         self.assertEqual(c.min_mag(Decimal(1), 2), d)
02111         self.assertEqual(c.min_mag(1, Decimal(2)), d)
02112         self.assertRaises(TypeError, c.min_mag, '1', 2)
02113         self.assertRaises(TypeError, c.min_mag, 1, '2')

Here is the call graph for this function:

Definition at line 2114 of file test_decimal.py.

02114 
02115     def test_minus(self):
02116         c = Context()
02117         d = c.minus(Decimal(10))
02118         self.assertEqual(c.minus(10), d)
02119         self.assertRaises(TypeError, c.minus, '10')

Here is the call graph for this function:

Definition at line 2120 of file test_decimal.py.

02120 
02121     def test_multiply(self):
02122         c = Context()
02123         d = c.multiply(Decimal(1), Decimal(2))
02124         self.assertEqual(c.multiply(1, 2), d)
02125         self.assertEqual(c.multiply(Decimal(1), 2), d)
02126         self.assertEqual(c.multiply(1, Decimal(2)), d)
02127         self.assertRaises(TypeError, c.multiply, '1', 2)
02128         self.assertRaises(TypeError, c.multiply, 1, '2')

Here is the call graph for this function:

Definition at line 2129 of file test_decimal.py.

02129 
02130     def test_next_minus(self):
02131         c = Context()
02132         d = c.next_minus(Decimal(10))
02133         self.assertEqual(c.next_minus(10), d)
02134         self.assertRaises(TypeError, c.next_minus, '10')

Here is the call graph for this function:

Definition at line 2135 of file test_decimal.py.

02135 
02136     def test_next_plus(self):
02137         c = Context()
02138         d = c.next_plus(Decimal(10))
02139         self.assertEqual(c.next_plus(10), d)
02140         self.assertRaises(TypeError, c.next_plus, '10')

Here is the call graph for this function:

Definition at line 2141 of file test_decimal.py.

02141 
02142     def test_next_toward(self):
02143         c = Context()
02144         d = c.next_toward(Decimal(1), Decimal(2))
02145         self.assertEqual(c.next_toward(1, 2), d)
02146         self.assertEqual(c.next_toward(Decimal(1), 2), d)
02147         self.assertEqual(c.next_toward(1, Decimal(2)), d)
02148         self.assertRaises(TypeError, c.next_toward, '1', 2)
02149         self.assertRaises(TypeError, c.next_toward, 1, '2')

Here is the call graph for this function:

Definition at line 2150 of file test_decimal.py.

02150 
02151     def test_normalize(self):
02152         c = Context()
02153         d = c.normalize(Decimal(10))
02154         self.assertEqual(c.normalize(10), d)
02155         self.assertRaises(TypeError, c.normalize, '10')

Here is the call graph for this function:

Definition at line 2156 of file test_decimal.py.

02156 
02157     def test_number_class(self):
02158         c = Context()
02159         self.assertEqual(c.number_class(123), c.number_class(Decimal(123)))
02160         self.assertEqual(c.number_class(0), c.number_class(Decimal(0)))
02161         self.assertEqual(c.number_class(-45), c.number_class(Decimal(-45)))

Here is the call graph for this function:

Definition at line 1810 of file test_decimal.py.

01810 
01811     def test_pickle(self):
01812         c = Context()
01813         e = pickle.loads(pickle.dumps(c))
01814         for k in vars(c):
01815             v1 = vars(c)[k]
01816             v2 = vars(e)[k]
01817             self.assertEqual(v1, v2)

Here is the call graph for this function:

Definition at line 2174 of file test_decimal.py.

02174 
02175     def test_plus(self):
02176         c = Context()
02177         d = c.plus(Decimal(10))
02178         self.assertEqual(c.plus(10), d)
02179         self.assertRaises(TypeError, c.plus, '10')

Here is the call graph for this function:

Definition at line 2162 of file test_decimal.py.

02162 
02163     def test_power(self):
02164         c = Context()
02165         d = c.power(Decimal(1), Decimal(4), Decimal(2))
02166         self.assertEqual(c.power(1, 4, 2), d)
02167         self.assertEqual(c.power(Decimal(1), 4, 2), d)
02168         self.assertEqual(c.power(1, Decimal(4), 2), d)
02169         self.assertEqual(c.power(1, 4, Decimal(2)), d)
02170         self.assertEqual(c.power(Decimal(1), Decimal(4), 2), d)
02171         self.assertRaises(TypeError, c.power, '1', 4, 2)
02172         self.assertRaises(TypeError, c.power, 1, '4', 2)
02173         self.assertRaises(TypeError, c.power, 1, 4, '2')

Here is the call graph for this function:

Definition at line 2180 of file test_decimal.py.

02180 
02181     def test_quantize(self):
02182         c = Context()
02183         d = c.quantize(Decimal(1), Decimal(2))
02184         self.assertEqual(c.quantize(1, 2), d)
02185         self.assertEqual(c.quantize(Decimal(1), 2), d)
02186         self.assertEqual(c.quantize(1, Decimal(2)), d)
02187         self.assertRaises(TypeError, c.quantize, '1', 2)
02188         self.assertRaises(TypeError, c.quantize, 1, '2')

Here is the call graph for this function:

Definition at line 2189 of file test_decimal.py.

02189 
02190     def test_remainder(self):
02191         c = Context()
02192         d = c.remainder(Decimal(1), Decimal(2))
02193         self.assertEqual(c.remainder(1, 2), d)
02194         self.assertEqual(c.remainder(Decimal(1), 2), d)
02195         self.assertEqual(c.remainder(1, Decimal(2)), d)
02196         self.assertRaises(TypeError, c.remainder, '1', 2)
02197         self.assertRaises(TypeError, c.remainder, 1, '2')

Here is the call graph for this function:

Definition at line 2198 of file test_decimal.py.

02198 
02199     def test_remainder_near(self):
02200         c = Context()
02201         d = c.remainder_near(Decimal(1), Decimal(2))
02202         self.assertEqual(c.remainder_near(1, 2), d)
02203         self.assertEqual(c.remainder_near(Decimal(1), 2), d)
02204         self.assertEqual(c.remainder_near(1, Decimal(2)), d)
02205         self.assertRaises(TypeError, c.remainder_near, '1', 2)
02206         self.assertRaises(TypeError, c.remainder_near, 1, '2')

Here is the call graph for this function:

Definition at line 2207 of file test_decimal.py.

02207 
02208     def test_rotate(self):
02209         c = Context()
02210         d = c.rotate(Decimal(1), Decimal(2))
02211         self.assertEqual(c.rotate(1, 2), d)
02212         self.assertEqual(c.rotate(Decimal(1), 2), d)
02213         self.assertEqual(c.rotate(1, Decimal(2)), d)
02214         self.assertRaises(TypeError, c.rotate, '1', 2)
02215         self.assertRaises(TypeError, c.rotate, 1, '2')

Here is the call graph for this function:

Definition at line 2222 of file test_decimal.py.

02222 
02223     def test_same_quantum(self):
02224         c = Context()
02225         d = c.same_quantum(Decimal(1), Decimal(2))
02226         self.assertEqual(c.same_quantum(1, 2), d)
02227         self.assertEqual(c.same_quantum(Decimal(1), 2), d)
02228         self.assertEqual(c.same_quantum(1, Decimal(2)), d)
02229         self.assertRaises(TypeError, c.same_quantum, '1', 2)
02230         self.assertRaises(TypeError, c.same_quantum, 1, '2')

Here is the call graph for this function:

Definition at line 2231 of file test_decimal.py.

02231 
02232     def test_scaleb(self):
02233         c = Context()
02234         d = c.scaleb(Decimal(1), Decimal(2))
02235         self.assertEqual(c.scaleb(1, 2), d)
02236         self.assertEqual(c.scaleb(Decimal(1), 2), d)
02237         self.assertEqual(c.scaleb(1, Decimal(2)), d)
02238         self.assertRaises(TypeError, c.scaleb, '1', 2)
02239         self.assertRaises(TypeError, c.scaleb, 1, '2')

Here is the call graph for this function:

Definition at line 2240 of file test_decimal.py.

02240 
02241     def test_shift(self):
02242         c = Context()
02243         d = c.shift(Decimal(1), Decimal(2))
02244         self.assertEqual(c.shift(1, 2), d)
02245         self.assertEqual(c.shift(Decimal(1), 2), d)
02246         self.assertEqual(c.shift(1, Decimal(2)), d)
02247         self.assertRaises(TypeError, c.shift, '1', 2)
02248         self.assertRaises(TypeError, c.shift, 1, '2')

Here is the call graph for this function:

Definition at line 2216 of file test_decimal.py.

02216 
02217     def test_sqrt(self):
02218         c = Context()
02219         d = c.sqrt(Decimal(10))
02220         self.assertEqual(c.sqrt(10), d)
02221         self.assertRaises(TypeError, c.sqrt, '10')

Here is the call graph for this function:

Definition at line 2249 of file test_decimal.py.

02249 
02250     def test_subtract(self):
02251         c = Context()
02252         d = c.subtract(Decimal(1), Decimal(2))
02253         self.assertEqual(c.subtract(1, 2), d)
02254         self.assertEqual(c.subtract(Decimal(1), 2), d)
02255         self.assertEqual(c.subtract(1, Decimal(2)), d)
02256         self.assertRaises(TypeError, c.subtract, '1', 2)
02257         self.assertRaises(TypeError, c.subtract, 1, '2')

Here is the call graph for this function:

Definition at line 2258 of file test_decimal.py.

02258 
02259     def test_to_eng_string(self):
02260         c = Context()
02261         d = c.to_eng_string(Decimal(10))
02262         self.assertEqual(c.to_eng_string(10), d)
02263         self.assertRaises(TypeError, c.to_eng_string, '10')

Here is the call graph for this function:

Definition at line 2270 of file test_decimal.py.

02270 
02271     def test_to_integral_exact(self):
02272         c = Context()
02273         d = c.to_integral_exact(Decimal(10))
02274         self.assertEqual(c.to_integral_exact(10), d)
02275         self.assertRaises(TypeError, c.to_integral_exact, '10')

Here is the call graph for this function:

Definition at line 2276 of file test_decimal.py.

02276 
02277     def test_to_integral_value(self):
02278         c = Context()
02279         d = c.to_integral_value(Decimal(10))
02280         self.assertEqual(c.to_integral_value(10), d)
02281         self.assertRaises(TypeError, c.to_integral_value, '10')

Here is the call graph for this function:

Definition at line 2264 of file test_decimal.py.

02264 
02265     def test_to_sci_string(self):
02266         c = Context()
02267         d = c.to_sci_string(Decimal(10))
02268         self.assertEqual(c.to_sci_string(10), d)
02269         self.assertRaises(TypeError, c.to_sci_string, '10')

Here is the call graph for this function:


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