From e8454c40c7449eb547784161d774d12b97dd357b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 24 Sep 2020 22:59:31 +0200 Subject: [PATCH] more tests --- python/tests/test_Geom.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index a91365727..9aff60186 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -83,6 +83,13 @@ class TestGeom: with pytest.raises(ValueError): Geom.load(tmpdir/'no_materialpoint.vtr') + def test_invalid_material(self): + with pytest.raises(TypeError): + Geom(np.zeros((3,3,3),dtype='complex'),np.ones(3)) + + def test_cast_to_int(self): + g = Geom(np.zeros((3,3,3)),np.ones(3)) + assert g.material.dtype in np.sctypes['int'] @pytest.mark.parametrize('compress',[True,False]) def test_compress(self,default,tmpdir,compress): @@ -324,8 +331,8 @@ class TestGeom: size = np.random.random(3) + 1.0 N_seeds= np.random.randint(10,30) seeds = np.random.rand(N_seeds,3) * np.broadcast_to(size,(N_seeds,3)) - Voronoi = Geom.from_Voronoi_tessellation( grid,size,seeds, periodic=periodic) - Laguerre = Geom.from_Laguerre_tessellation(grid,size,seeds,np.ones(N_seeds),periodic=periodic) + Voronoi = Geom.from_Voronoi_tessellation( grid,size,seeds, np.arange(N_seeds)+5,periodic) + Laguerre = Geom.from_Laguerre_tessellation(grid,size,seeds,np.ones(N_seeds),np.arange(N_seeds)+5,periodic) assert geom_equal(Laguerre,Voronoi)