示例#1
0
def test_emptytree():
    """Test empty schedule sections. Don't want to crash"""
    schstr = ""
    deck = EclFiles.str2deck(schstr)
    grupdf = gruptree.df(deck)
    assert grupdf.empty
    gruptreedict = gruptree.df2dict(grupdf)
    assert not gruptreedict
    treelibtree = gruptree.dict2treelib("", gruptreedict)
    treestring = str(treelibtree)
    assert not treestring.strip()  # Let it return whitespace
示例#2
0
def test_grupnet_rst_docs(tmpdir):
    """Provide the input and output for the examples in the RST documentation"""
    tmpdir.chdir()
    schstr = """
START
 01 'JAN' 2000 /

SCHEDULE

GRUPTREE
 'OPEAST' 'OP' /
 'OPWEST' 'OP' /
 'INJEAST' 'WI' /
 'OP' 'FIELD' /
 'WI' 'FIELD' /
 'FIELD' 'AREA' /
 'AREA' 'NORTHSEA' /
/

GRUPNET
  'FIELD' 90 /
  'OPWEST' 100 /
/

WELSPECS
 'OP1'  'OPWEST'  41 125 1759.74 'OIL' 0.0 'STD' 'SHUT' 'YES'  0  'SEG' /
 'OP2'  'OPEAST'  43 122 1776.01 'OIL' 0.0 'STD' 'SHUT' 'YES'  0  'SEG' /
 'INJ1' 'INJEAST' 33 115 1960.21 'OIL' 0.0 'STD' 'SHUT' 'YES'  0  'SEG' /
/

"""
    deck = EclFiles.str2deck(schstr)
    grupdf = gruptree.df(deck)
    grupdf[["DATE", "CHILD", "PARENT", "KEYWORD"]].to_csv("gruptree.csv",
                                                          index=False)
    grupdf.to_csv("gruptreenet.csv", index=False)
    grup_dict = gruptree.df2dict(grupdf)
    print("Copy and paste into RST files:")
    print(str(gruptree.dict2treelib("", grup_dict[0])))
示例#3
0
def test_dict2treelib_deprecated():
    """dict2treelib is deprecated and replaced by tree_from_dict()"""
    with pytest.warns(FutureWarning):
        gruptree.dict2treelib("foo", {"bar": {}})