Skip to content

Commit

Permalink
Parse dir (#63)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jessepisel authored Mar 23, 2021
1 parent cd94f87 commit 52b98d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion alaska/keyword_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [], []
Expand Down
9 changes: 9 additions & 0 deletions alaska/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52b98d7

Please sign in to comment.