def test_extract_columnnames(filelines, expected): """Test the ability to extract columnnames from a string occuring in OFM lines""" if isinstance(expected, list): assert ofmvol2csv.extract_columnnames(filelines) == expected else: with pytest.raises(expected): ofmvol2csv.extract_columnnames(filelines)
def test_parse_well(inputlines, expected): if "DATE" in expected: expected["DATE"] = pd.to_datetime(expected["DATE"]) expected.set_index(["WELL", "DATE"], inplace=True) # Assume there is DATE line in the test input inputlines = ofmvol2csv.cleanse_ofm_lines(inputlines) colnames = ofmvol2csv.extract_columnnames(inputlines) dframe = ofmvol2csv.parse_well(inputlines[1:], colnames) pd.testing.assert_frame_equal(dframe, expected)
def test_extract_columnnames(filelines, expected): if isinstance(expected, list): assert ofmvol2csv.extract_columnnames(filelines) == expected else: with pytest.raises(expected): ofmvol2csv.extract_columnnames(filelines)