Esempio n. 1
0
def test_basic(capsys):

    prj = MicroappProject()
    cmd = "uxml2dict \"%s\" -p" % data

    ret, fwds = prj.run_command(cmd)

    assert ret == 0
    captured = capsys.readouterr()
    assert captured.out.startswith("OrderedDict")
    assert captured.err == ""
Esempio n. 2
0
def test_basic():

    prj = MicroappProject()
    cmd = "gunzip %s -o %s" % (zipped, unzipped)

    ret, fwds = prj.run_command(cmd)

    assert ret == 0
    assert os.path.exists(unzipped)

    os.remove(unzipped)
Esempio n. 3
0
def test_basic():

    prj = MicroappProject()
    cmd = "nmlread %s -o %s" % (namelist, jsondata)

    ret, fwds = prj.run_command(cmd)

    assert ret == 0
    assert os.path.exists(jsondata)

    os.remove(jsondata)
Esempio n. 4
0
def test_basic():

    prj = MicroappProject()
    data = '\'["foo", {"bar": ["baz", null, 1.0, 2]}]\''
    cmd = "dict2json %s -o %s" % (data, jsondata)

    ret, fwds = prj.run_command(cmd)

    assert ret == 0
    assert os.path.exists(jsondata)

    os.remove(jsondata)
Esempio n. 5
0
def test_basic():

    prj = MicroappProject()
    data = "@[1,2,4,3]"
    cmd = "matplot %s -o @<'\"%s\"'> --noshow" % (data, outimg)

    ret = prj.main(cmd)

    assert ret == 0
    assert os.path.exists(outimg)

    os.remove(outimg)
Esempio n. 6
0
def test_title():

    prj = MicroappProject()
    data = "@[1,2,4,3]"
    cmd = "matplot %s --title 'ax:My figure' -o %s --noshow" % (data, outimg)

    ret = prj.main(cmd)

    assert ret == 0
    assert os.path.exists(outimg)

    os.remove(outimg)
Esempio n. 7
0
def test_basic():

    prj = MicroappProject()

    cmd = ["xrcalc"]
    cmd.append("data = xr.DataArray(np.random.randn(2, 3), dims=('x', 'y'), coords={'x': [10, 20]})")
    cmd.append("temp = xr.DataArray(pd.Series(range(3), index=list('abc'), name='foo'))")
    cmd.append("-s")
    cmd.append("temp")

    ret = prj.main(" ".join(["\"%s\"" % c for c in cmd]))

    assert ret == 0
Esempio n. 8
0
import os
from microapp import MicroappProject

here = os.path.dirname(os.path.abspath(__file__))

prj = MicroappProject()

def test_basic():

    rdr = os.path.join(here, "..", "nmlreader.py")
    nml = os.path.join(here, "..", "res", "e3sm_atm_in")
    cmd = "%s %s" % (rdr, nml)

    ret, fwds = prj.run_command(cmd)

    assert ret == 0
#
#def test_print(capsys):
#
#    cmd = "-- input @1 --forward '@x=2' -- print @x @data[0]"
#    ret = prj.main(cmd)
#
#    assert ret == 0
#
#    captured = capsys.readouterr()
#    assert captured.out == "21\n"
#    assert captured.err == ""