Skip to content

Commit f995eaf

Browse files
author
Adios Automated Script
committed
Merge branch 'develop'
2 parents b388fbb + 51cd37a commit f995eaf

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

oil_library/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from .models import DBSession
1717

18-
__version__ = '2.0.0'
18+
__version__ = '2.0.1'
1919

2020

2121
#

oil_library/oil_props.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ def __eq__(self, other):
314314
except Exception:
315315
return False
316316

317+
def __hash__(self):
318+
"""
319+
so that we can use lru_cache on the methods of the object
320+
"""
321+
return id(self)
322+
317323
def __ne__(self, other):
318324
return not self == other
319325

oil_library/tests/test_oil_props.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,43 @@ def test_deepcopy(self):
194194
assert getattr(op, item) is getattr(dcop, item)
195195
else:
196196
assert getattr(op, item) is not getattr(dcop, item)
197+
198+
199+
def test_hash():
200+
"""
201+
make sure OilProps is hashable
202+
"""
203+
op = get_oil_props('ALASKA NORTH SLOPE (MIDDLE PIPELINE, 1997)')
204+
205+
print(dir(op))
206+
print(op.__hash__)
207+
print(f"Hash is: {op.__hash__()}")
208+
209+
# this may change, but fpr now
210+
assert hash(op) == id(op)
211+
212+
213+
def test_vapor_pressure():
214+
215+
# making sure the lru_cache works
216+
op = get_oil_props('ALASKA NORTH SLOPE (MIDDLE PIPELINE, 1997)')
217+
218+
vp = op.vapor_pressure(303)
219+
220+
print(f"{vp=}")
221+
222+
# I have no idea if these values are correct
223+
assert np.allclose(vp, np.array([4.25112967e+04, 4.25112967e+04,
224+
4.33030879e+03, 4.33030879e+03,
225+
3.44544154e+02, 3.44544154e+02,
226+
2.11131481e+01, 2.11131481e+01,
227+
1.03347266e+00, 1.03347266e+00,
228+
4.67207773e-02, 4.67207773e-02,
229+
2.25663515e-03, 2.25663515e-03,
230+
1.34558585e-04, 1.34558585e-04,
231+
2.73632461e-05, 2.73632461e-05,
232+
1.91947361e-05, 1.91947361e-05,
233+
4.83593789e-19, 4.83593789e-19]))
234+
235+
236+

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def run(self):
162162
# build_py is an old-style class, so we can't use super()
163163
build_py.run(self)
164164

165-
DESCRIPTION = ('{}: The NOAA library of oils and their properties.\n'
166-
'Branch: {}\n'
165+
DESCRIPTION = ('{}: The NOAA library of oils and their properties.'
166+
'Branch: {}'
167167
'LastUpdate: {}'
168168
.format(pkg_name, *get_repo_data())
169169
)

0 commit comments

Comments
 (0)