Commit 4f0a07e1 authored by Greg Harris's avatar Greg Harris
Browse files

Adding tests for build_well_log_data

parent 5835f20e
......@@ -73,7 +73,6 @@ The LASCLI requires a configuration file that has the following JSON structure:
{
"data_partition_id": "opendes",
"acl_domain": "contoso.com",
"ref_curve_id": "DEPT",
"legal":
{
"legaltags": ["opendes-public-usa-dataset-7643990"],
......
{
"data_partition_id": "opendes",
"acl_domain": "contoso.com",
"ref_curve_id": "DEPT",
"legal":
{
"legaltags": ["opendes-public-usa-dataset-7643990"],
......
......@@ -181,7 +181,7 @@ class AttributeBuilder:
if None in [wellbore_id]:
raise ValueError("Wellbore ID")
if las.curves[0].mnemonic is not None and las.curves[0].original_mnemonic != "":
if las.curves is not None and len(las.curves) > 0 and las.curves[0].mnemonic is not None and las.curves[0].original_mnemonic != "":
ref_curve_id = las.curves[0].mnemonic
else:
raise ValueError("Failed to extract reference curve ID from LAS file.")
......
......@@ -8,7 +8,6 @@
],
"status": "compliant"
},
"ref_curve_id": "DEPT",
"data": {
"default": {
"viewers": [ "data.default.viewers@opendes.contoso.com" ],
......
......@@ -4,7 +4,6 @@
"legaltags": ["opendes-public-usa-dataset-7643990"],
"status": "compliant"
},
"ref_curve_id": "DEPT",
"data": {
"default": {
"viewers": [ "data.default.viewers@opendes.contoso.com" ],
......
......@@ -158,6 +158,43 @@ class TestWellboreAttributeBuilders:
"NameAliases": attr_builder._build_name_aliases(uwi, config)
}
def test_build_well_log_data_returns_expected_ref_curve_id(
self, attr_builder, las, config):
"""
The returned object should include two attributes - facility name and name aliases.
"""
# Arrange
# Act
data = attr_builder.build_well_log_data(las, config, "boreId")
# Assert
assert data == {
"ReferenceCurveID": las.curves[0].mnemonic,
"Curves": attr_builder._build_curves(las, config.data_partition_id),
"WellboreID": "boreId:",
}
def test_build_well_log_data_raises_on_no_curves(
self, attr_builder, config):
"""
The returned object should include two attributes - facility name and name aliases.
"""
# Arrange
las = Mock()
las.curves = None
# Act
with pytest.raises(ValueError, match=r".*Failed to extract reference curve ID from LAS file.*"):
attr_builder.build_well_log_data(las, config, "boreId")
las.curves = []
# Act
with pytest.raises(ValueError, match=r".*Failed to extract reference curve ID from LAS file.*"):
attr_builder.build_well_log_data(las, config, "boreId")
class TestWellLogAttributeBuilders:
def test_build_curves_returns_list_of_curve_dictionaries(self, attr_builder, las):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment