def test_abs(self): x = 42 f1 = iobj.W_IntObject(x) v = iobj.abs__Int(self.space, f1) assert v.intval == abs(x) x = -42 f1 = iobj.W_IntObject(x) v = iobj.abs__Int(self.space, f1) assert v.intval == abs(x) x = -sys.maxint-1 f1 = iobj.W_IntObject(x) assert self.space.w_OverflowError == ( self._unwrap_nonimpl(iobj.abs__Int, self.space, f1))
def test_abs(self): x = 42 f1 = iobj.W_IntObject(x) v = iobj.abs__Int(self.space, f1) assert v.intval == abs(x) x = -42 f1 = iobj.W_IntObject(x) v = iobj.abs__Int(self.space, f1) assert v.intval == abs(x) x = -sys.maxint - 1 f1 = iobj.W_IntObject(x) assert self.space.w_OverflowError == (self._unwrap_nonimpl( iobj.abs__Int, self.space, f1))