Commit 560e8417 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

more coverage

parent 96f5fa4c
Pipeline #26727 failed with stage
in 11 minutes and 18 seconds
......@@ -123,3 +123,38 @@ class Test_Functionality(unittest.TestCase):
m = ift.Field.full((x1, x2), .5)
res = m.vdot(m, spaces=1)
assert_allclose(res.local_data, 37.5)
def test_stdfunc(self):
s = ift.RGSpace((200,))
f = ift.Field(s, 27)
assert_equal(f.local_data, 27)
assert_equal(f.shape, (200,))
assert_equal(f.dtype, np.int)
fx = ift.Field.empty_like(f)
assert_equal(f.dtype, fx.dtype)
assert_equal(f.shape, fx.shape)
fx = ift.Field.zeros_like(f)
assert_equal(f.dtype, fx.dtype)
assert_equal(f.shape, fx.shape)
assert_equal(fx.local_data, 0)
fx = ift.Field.ones_like(f)
assert_equal(f.dtype, fx.dtype)
assert_equal(f.shape, fx.shape)
assert_equal(fx.local_data, 1)
fx = ift.Field.full_like(f, 67.)
assert_equal(f.shape, fx.shape)
assert_equal(fx.local_data, 67.)
f = ift.Field.from_random("normal", s)
f2 = ift.Field.from_random("normal", s)
assert_equal((f > f2).local_data, f.local_data > f2.local_data)
assert_equal((f >= f2).local_data, f.local_data >= f2.local_data)
assert_equal((f < f2).local_data, f.local_data < f2.local_data)
assert_equal((f <= f2).local_data, f.local_data <= f2.local_data)
assert_equal((f != f2).local_data, f.local_data != f2.local_data)
assert_equal((f == f2).local_data, f.local_data == f2.local_data)
assert_equal((f+f2).local_data, f.local_data+f2.local_data)
assert_equal((f-f2).local_data, f.local_data-f2.local_data)
assert_equal((f*f2).local_data, f.local_data*f2.local_data)
assert_equal((f/f2).local_data, f.local_data/f2.local_data)
assert_equal((-f).local_data, -(f.local_data))
assert_equal(abs(f).local_data, abs(f.local_data))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment