Esempio n. 1
0
def test_get_observations(drogondata):
    """Try to parse observations"""
    dframe = get_observations("rft")
    expected = pd.DataFrame(
        columns=["order", "well", "report_step", "observed", "error"],
        data=[
            [0, "R_A2", 1, 299.23, 3.0],
            [0, "R_A3", 1, 298.52, 3.0],
            [1, "R_A3", 1, 280.43, 3.0],
            [0, "R_A4", 1, 288.60, 3.0],
            [1, "R_A4", 1, 282.13, 3.0],
            [0, "R_A5", 1, 278.70, 3.0],
            [1, "R_A5", 1, 286.55, 3.0],
            [0, "R_A6", 1, 280.85, 3.0],
            [1, "R_A6", 1, 286.41, 3.0],
        ],
    )
    pd.testing.assert_frame_equal(dframe, expected)
Esempio n. 2
0
def test_get_observations_invalid(obsstring, validlength, tmp_path):
    """Check observation parsing"""
    os.chdir(tmp_path)
    Path("foo.obs").write_text(obsstring, encoding="utf8")
    assert len(get_observations(".")) == validlength
Esempio n. 3
0
def test_get_observations_invalid(obsstring, validlength, tmpdir):
    """Check observation parsing"""
    tmpdir.chdir()
    Path("foo.obs").write_text(obsstring)
    assert len(get_observations(".")) == validlength
Esempio n. 4
0
def test_get_observations_invalid(obsstring, validlength, tmpdir):
    """Check observation parsing"""
    tmpdir.chdir()
    with open("foo.obs", "w") as file_h:
        file_h.write(obsstring)
    assert len(get_observations(".")) == validlength