Expose the Parser class properly to Python
This commit is contained in:
52
python/tests/test_parser.py
Normal file
52
python/tests/test_parser.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import unittest
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
from opm.io.parser import Parser
|
||||
from opm.io.parser import ParseContext
|
||||
|
||||
class TestParser(unittest.TestCase):
|
||||
|
||||
REGIONDATA = """
|
||||
START -- 0
|
||||
10 MAI 2007 /
|
||||
RUNSPEC
|
||||
|
||||
DIMENS
|
||||
2 2 1 /
|
||||
GRID
|
||||
DX
|
||||
4*0.25 /
|
||||
DY
|
||||
4*0.25 /
|
||||
DZ
|
||||
4*0.25 /
|
||||
TOPS
|
||||
4*0.25 /
|
||||
REGIONS
|
||||
OPERNUM
|
||||
3 3 1 2 /
|
||||
FIPNUM
|
||||
1 1 2 3 /
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.spe3fn = 'tests/spe3/SPE3CASE1.DATA'
|
||||
self.norne_fname = os.path.abspath('examples/data/norne/NORNE_ATW2013.DATA')
|
||||
|
||||
def test_create(self):
|
||||
parser = Parser()
|
||||
deck = parser.parse(self.spe3fn)
|
||||
|
||||
context = ParseContext()
|
||||
deck = parser.parse(self.spe3fn, context)
|
||||
|
||||
with open(self.spe3fn) as f:
|
||||
string = f.read()
|
||||
deck = parser.parse_string(string)
|
||||
deck = parser.parse_string(string, context)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user