Skip to content

Commit

Permalink
adding some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mt2312 committed Aug 6, 2021
1 parent e22e148 commit 722e396
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/grid/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

FILE = '../Data/dome.grdecl'
BASENAME = 'dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Desktop/Repositories/apyce-project/tests/Data/dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Documents/Repositories/apyce-project/tests/Data/dome.grdecl'
DIRNAME = '../Data'

class TestGrid():
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

FILE = '../Data/dome.grdecl'
BASENAME = 'dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Desktop/Repositories/apyce-project/tests/Data/dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Documents/Repositories/apyce-project/tests/Data/dome.grdecl'
DIRNAME = '../Data'


Expand Down
31 changes: 18 additions & 13 deletions tests/utils/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@

class TestErrors():
def test_errors(self):
assert Errors.CART_DIMS_ERROR.value == "[ERROR] Attempting to change already defined grid size"
assert Errors.DIMENS_ERROR.value == "[ERROR] Only corner-point grid are supported"
assert Errors.COORD_ERROR.value == "[ERROR] COORD data size must be 6*(NX+1)*(NY+1)"
assert Errors.ZCORN_ERROR.value == "[ERROR] ZCORN data size must be 2*NX*2*NY*2*NZ"
assert Errors.PORO_ERROR.value == "[ERROR] PORO data size must be NX*NY*NZ"
assert Errors.PERMX_ERROR.value == "[ERROR] PERMX data size must be NX*NY*NZ"
assert Errors.PERMY_ERROR.value == "[ERROR] PERMY data size must be NX*NY*NZ"
assert Errors.PERMZ_ERROR.value == "[ERROR] PERMZ data size must be NX*NY*NZ"
assert Errors.ACTNUM_ERROR.value == "[ERROR] ACTNUM data size must be NX*NY*NZ"
assert Errors.SO_ERROR.value == "[ERROR] SO data size must be NX*NY*NZ"
assert Errors.GRID_NOT_DEFINED_ERROR.value == "[ERROR] Invoking process_grdecl before read_grdecl"
assert Errors.CHECK_DIM_ERRROR.value == "[ERROR] GRDECL keyword {} found before dimension specification"
assert Errors.LOAD_CELL_DATA_ERROR.value == "[ERROR] {} data size must be NX*NY*NZ"
assert Errors.CART_DIMS_ERROR.value == "Attempting to change already defined grid size"
assert Errors.COORD_ERROR.value == "COORD data size must be 6*(NX+1)*(NY+1)"
assert Errors.ZCORN_ERROR.value == "ZCORN data size must be 2*NX*2*NY*2*NZ"
assert Errors.PORO_ERROR.value == "PORO data size must be NX*NY*NZ"
assert Errors.PERMX_ERROR.value == "PERMX data size must be NX*NY*NZ"
assert Errors.PERMY_ERROR.value == "PERMY data size must be NX*NY*NZ"
assert Errors.PERMZ_ERROR.value == "PERMZ data size must be NX*NY*NZ"
assert Errors.ACTNUM_ERROR.value == "ACTNUM data size must be NX*NY*NZ"
assert Errors.SO_ERROR.value == "SO data size must be NX*NY*NZ"
assert Errors.GRID_NOT_DEFINED_ERROR.value == "The grid is not defined!"
assert Errors.CHECK_DIM_ERRROR.value == "GRDECL keyword {} found before dimension specification"
assert Errors.LOAD_CELL_DATA_ERROR.value == "{} data size must be NX*NY*NZ"
assert Errors.TOPS_ERROR.value == "TOPS data size must be NX*NY"
assert Errors.DX_ERROR.value == "DX data size must be NX*NY*NZ"
assert Errors.DY_ERROR.value == "DY data size must be NX*NY*NZ"
assert Errors.DZ_ERROR.value == "DZ data size must be NX*NY*NZ"
assert Errors.FILE_NOT_FOUND_ERROR.value == "Can't open the file {}"
assert Errors.EOF_ERROR.value == "EOF when reading a line"
8 changes: 1 addition & 7 deletions tests/utils/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

FILE = '../Data/dome.grdecl'
BASENAME = 'dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Desktop/Repositories/apyce-project/tests/Data/dome.grdecl'
ABSOLUTE_PATH = '/home/metzker/Documents/Repositories/apyce-project/tests/Data/dome.grdecl'
DIRNAME = '../Data'


Expand All @@ -31,12 +31,6 @@ def test_check_dim(self):
file = None
assert misc.check_dim(cart_dims, num_cell, keywords, file) is None

def test_check_grid(self):
cart_dims = [20, 20, 4]
coord = [0]
zcorn = [0]
assert misc.check_grid(cart_dims, coord, zcorn) is None

def test_create_results_directory(self):
assert misc.create_results_directory(FILE) == '../Data/Results/'
os.removedirs('../Data/Results')
Expand Down

0 comments on commit 722e396

Please sign in to comment.