From 4b700d367e1ebb6e07453e167348028fcb840d29 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Oct 2020 17:52:16 +0100 Subject: [PATCH] improved test --- python/damask/_configmaterial.py | 1 - python/tests/test_Geom.py | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index c625e6251..8b4f1c5ea 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -2,7 +2,6 @@ import copy import numpy as np -from . import grid_filters from . import Config from . import Lattice from . import Rotation diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index dd9c28a3e..03bd92e13 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -379,8 +379,9 @@ class TestGeom: grid = np.random.randint(60,100,3) size = np.ones(3)+np.random.rand(3) coords = grid_filters.cell_coord0(grid,size).reshape(-1,3,order='F') - x = np.ones(grid.prod()).reshape(-1,1) - y = np.hstack([np.arange(grid[1])]*grid[0]*grid[2]).reshape(-1,1) - t = Table(np.hstack((coords,x,y)),{'coords':3,'x':1,'y':1}) - g = Geom.from_table(t,'coords',['x','y']) - assert g.N_materials == g.grid[2] + z=np.ones(grid.prod()) + z[int(z.size/2):]=0 + t = Table(np.column_stack((coords,z)),{'coords':3,'z':1}) + g = Geom.from_table(t,'coords',['1_coords','z']) + assert g.N_materials == g.grid[0]*2 and \ + (g.material[:,:,-1]-g.material[:,:,0]-grid[:1].prod() == 0).all()