def test_wateroil_linear(): """Test linear wateroil curves""" wateroil = WaterOil(h=1) wateroil.add_corey_water() wateroil.add_corey_oil() swofstr = wateroil.SWOF(header=False) check_table(wateroil.table) check_linear_sections(wateroil) assert isinstance(swofstr, str) assert swofstr assert len(wateroil.table) == 2 assert np.isclose(wateroil.crosspoint(), 0.5) # What if there is no space for our choice of h? # We should be able to initialize nonetheless # (a warning could be given) wateroil = WaterOil(swl=0.1, h=1) wateroil.add_corey_water() wateroil.add_corey_oil() check_table(wateroil.table) check_linear_sections(wateroil) assert len(wateroil.table) == 2 assert np.isclose(wateroil.table["SW"].min(), 0.1) assert np.isclose(wateroil.table["SW"].max(), 1.0) assert np.isclose(wateroil.crosspoint(), 0.55)
def test_wateroil_krendmax(swl, swcr, sorw, kroend, kromax, krwend, krwmax, h, fast): """Test endpoints for wateroil using hypothesis testing""" try: wateroil = WaterOil(swl=swl, swcr=swcr, sorw=sorw, h=h, fast=fast) except AssertionError: return kroend = min(kroend, kromax) krwend = min(krwend, krwmax) wateroil.add_corey_oil(kroend=kroend, kromax=kromax) wateroil.add_corey_water(krwend=krwend, krwmax=krwmax) check_table(wateroil.table) assert wateroil.selfcheck() assert 0 < wateroil.crosspoint() < 1 check_endpoints(wateroil, krwend, krwmax, kroend, kromax) #################################### # Do it over again, but with LET: wateroil.add_LET_oil(t=1.1, kroend=kroend, kromax=kromax) wateroil.add_LET_water(t=1.1, krwend=krwend, krwmax=krwmax) assert wateroil.selfcheck() check_table(wateroil.table) # Check endpoints for oil curve: check_endpoints(wateroil, krwend, krwmax, kroend, kromax) check_linear_sections(wateroil) assert 0 < wateroil.crosspoint() < 1