From 52b98d7e18ffc317163fe7f1d9a54fa36fcd4a66 Mon Sep 17 00:00:00 2001 From: Jesse Pisel Date: Tue, 23 Mar 2021 12:24:39 -0500 Subject: [PATCH] Parse dir (#63) * update parse_directory updated parse_directory so that capitalization in the file extension does not matter. * Update test_parser.py added test to ensure that the alias dictionary has keys when parsing a directory --- alaska/keyword_tree.py | 2 +- alaska/tests/test_parser.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/alaska/keyword_tree.py b/alaska/keyword_tree.py index 8b60397..5e72c24 100644 --- a/alaska/keyword_tree.py +++ b/alaska/keyword_tree.py @@ -266,7 +266,7 @@ def parse_directory(self, directory): comprehensive_dict = {} comprehensive_not_found = [] for filename in os.listdir(directory): - if filename.endswith(".las"): + if filename.endswith((".LAS",".las")): path = os.path.join(directory, filename) las = lasio.read(path) mnem, desc = [], [] diff --git a/alaska/tests/test_parser.py b/alaska/tests/test_parser.py index 4d2221d..5148f61 100644 --- a/alaska/tests/test_parser.py +++ b/alaska/tests/test_parser.py @@ -199,6 +199,15 @@ def test_parse_directory_2(): assert "empty" in not_aliased +def test_parse_directory_3(): + """ + Test that Aliaser can parse .LAS and .las + """ + aliaser = Alias() + aliased, _ = aliaser.parse_directory(test_dir_1) + assert len(aliased.keys()) > 0 + + def test_dictionary_parse_1(): """ Test that dictionary parser in Aliaser parses and returns correct labels