

def test_pow(self, space):
    w_res = space.execute('return 1.0 ** 2')
    assert (self.unwrap(space, w_res) == 1.0)
    w_res = space.execute('return 2.0 ** 2')
    assert (self.unwrap(space, w_res) == 4.0)
    w_res = space.execute('return 2.0 ** 0')
    assert (self.unwrap(space, w_res) == 1.0)
    w_res = space.execute('return 4.0 ** 4.0')
    assert (self.unwrap(space, w_res) == 256.0)
    w_res = space.execute('return 0.0 ** (-1.0)')
    assert (self.unwrap(space, w_res) == float('inf'))
    w_res = space.execute('return (-2.0) ** 2')
    assert (self.unwrap(space, w_res) == 4)
    w_res = space.execute('return (-2.0) ** 3')
    assert (self.unwrap(space, w_res) == (- 8))
    w_res = space.execute('return (-2.0) ** -2')
    assert (self.unwrap(space, w_res) == 0.25)
    w_res = space.execute('return (-2.0) ** -3')
    assert (self.unwrap(space, w_res) == (- 0.125))
    with self.raises(space, 'TypeError', "String can't be coerced into Bignum"):
        space.execute("18446744073709551628 ** 'hallo'")

dataset/ETHPy150Open topazproject/topaz/tests/objects/test_floatobject.py TestFloatObject.test_pow/original