"""volve_dia.names: every spelling of a Volve wellbore maps to one canonical NPD code.""" import pytest from volve_dia.names import canonical, stem, well_of @pytest.mark.parametrize("name, expected", [ ("NO 15/9-F-15 A", "15/9-F-15 A"), # DDR nameWellbore ("15_9_F_15_A", "15/9-F-15 A"), # DDR file stem ("15/9-F-15 A", "15/9-F-15 A"), # NPD code ("Norway-StatoilHydro-15_$47$_9-F-15A", "15/9-F-15 A"), # WITSML folder ("15/9-F-15A", "15/9-F-15 A"), # MetaFileInfo.txt ("NO 15/9-F-1 B", "15/9-F-1 B"), ("Norway-Statoil-NO 15_$47$_9-F-1 C", "15/9-F-1 C"), ("NA-NA-15_$47$_9-F-5", "15/9-F-5"), ("15_9_F_11_T2", "15/9-F-11 T2"), ("15_9_19_BT2", "15/9-19 BT2"), ("15_9_19_S", "15/9-19 S"), (" NO 15/9-F-12 ", "15/9-F-12"), ]) def test_canonical(name, expected): assert canonical(name) == expected def test_stem_and_well(): assert stem("NO 15/9-F-15 A") == "15_9_F_15_A" assert stem("15/9-19 BT2") == "15_9_19_BT2" assert well_of("Norway-StatoilHydro-15_$47$_9-F-15A") == "15/9-F-15" @pytest.mark.parametrize("name", ["", "F-15", "15/9", "Volve"]) def test_rejects_non_wellbores(name): with pytest.raises(ValueError): canonical(name)