def build_oil_props(props, max_cuts=2): ''' Builds an OilProps object from a dict of properties and max_cuts ''' return OilProps(sample_oil_to_mock_oil(max_cuts, **props))
# Some standard oils - scope is module level, non-public # create mock_oil objects instead of dict - we always want the same instance # of mock_oil object for say 'oil_conservative' otherwise equality fails _sample_oils = { 'oil_gas': sample_oil_to_mock_oil(max_cuts=2, **{ 'name': 'oil_gas', 'api': uc.convert('Density', 'gram per cubic centimeter', 'API degree', 0.75), 'kvis': [{ 'm_2_s': 1.32e-6, 'ref_temp_k': 273.15 }, { 'm_2_s': 9.98e-7, 'ref_temp_k': 288.15 }, { 'm_2_s': 8.6e-7, 'ref_temp_k': 311.0 }], }), 'oil_jetfuels': sample_oil_to_mock_oil(max_cuts=2, **{ 'name': 'oil_jetfuels', 'api':
from oil_library.mock_oil import sample_oil_to_mock_oil from oil_library.oil_props import OilProps # Some standard oils - scope is module level, non-public # create mock_oil objects instead of dict - we always want the same instance # of mock_oil object for say 'oil_conservative' otherwise equality fails _sample_oils = { 'oil_gas': sample_oil_to_mock_oil(max_cuts=2, **{'name': 'oil_gas', 'api': uc.convert('Density', 'gram per cubic centimeter', 'API degree', 0.75), 'kvis': [{'m_2_s': 1.32e-6, 'ref_temp_k': 273.15}, {'m_2_s': 9.98e-7, 'ref_temp_k': 288.15}, {'m_2_s': 8.6e-7, 'ref_temp_k': 311.0}], } ), 'oil_jetfuels': sample_oil_to_mock_oil(max_cuts=2, **{'name': 'oil_jetfuels', 'api': uc.convert('Density', 'gram per cubic centimeter', 'API degree', 0.81), 'kvis': [{'m_2_s': 6.9e-6, 'ref_temp_k': 255.0}, {'m_2_s': 2.06e-6,
def test_sample_oil_to_mock_oil(): oil_ = sample_oil_to_mock_oil(max_cuts=2, **so) for key, val in so.iteritems(): assert val == getattr(oil_, key)
try: __version__ = get_distribution("OilLibrary").version except: __version__ = "not_found" # Some standard oils - scope is module level, non-public # create mock_oil objects instead of dict - we always want the same instance # of mock_oil object for say 'oil_conservative' otherwise equality fails _sample_oils = { "oil_gas": sample_oil_to_mock_oil( max_cuts=2, **{ "name": "oil_gas", "api": uc.convert("Density", "gram per cubic centimeter", "API degree", 0.75), "kvis": [ {"m_2_s": 1.32e-6, "ref_temp_k": 273.15}, {"m_2_s": 9.98e-7, "ref_temp_k": 288.15}, {"m_2_s": 8.6e-7, "ref_temp_k": 311.0}, ], } ), "oil_jetfuels": sample_oil_to_mock_oil( max_cuts=2, **{ "name": "oil_jetfuels", "api": uc.convert("Density", "gram per cubic centimeter", "API degree", 0.81), "kvis": [ {"m_2_s": 6.9e-6, "ref_temp_k": 255.0}, {"m_2_s": 2.06e-6, "ref_temp_k": 273.0}, {"m_2_s": 2.08e-6, "ref_temp_k": 288.0}, {"m_2_s": 1.3e-6, "ref_temp_k": 313.0},