def _test_rational_new(cls):
 assert (cls(0) is S.Zero)
 assert (cls(1) is S.One)
 assert (cls((-1)) is S.NegativeOne)
 assert (cls('1') is S.One)
 assert (cls(u'-1') is S.NegativeOne)
 i = Integer(10)
 assert _strictly_equal(i, cls('10'))
 assert _strictly_equal(i, cls(u'10'))
 assert _strictly_equal(i, cls(long(10)))
 assert _strictly_equal(i, cls(i))
 raises(TypeError, (lambda : cls(Symbol('x'))))

def _test_rational_new ( cls ) : assert ( cls ( 0 ) is S . Zero ) assert ( cls ( 1 ) is S . One ) assert ( cls ( ( - 1 ) ) is S . NegativeOne ) assert ( cls ( '1' ) is S . One ) assert ( cls ( u'-1' ) is S . NegativeOne ) i = Integer ( 10 ) assert _strictly_equal ( i , cls ( '10' ) ) assert _strictly_equal ( i , cls ( u'10' ) ) assert _strictly_equal ( i , cls ( long ( 10 ) ) ) assert _strictly_equal ( i , cls ( i ) ) raises ( TypeError , ( lambda : cls ( Symbol ( 'x' ) ) ) )
tests that are common between integer and rational .