Skip to content

Commit

Permalink
bump version, add custom path to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchenknif committed Feb 17, 2019
1 parent 1ec88d4 commit 6c19edc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PyTMM/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"""

__author__ = "Pavel Dmitriev"
__version__ = "1.0.1c"
__version__ = "1.0.2"
__license__ = "GPLv3"
47 changes: 41 additions & 6 deletions PyTMM/tests/test_refractiveIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,40 @@


class TestRefractiveIndex(TestCase):

def test_defaultInit(self):
database = RefractiveIndex()
assert os.path.exists(database.referencePath)
assert os.path.exists(os.path.join(database.referencePath, os.path.normpath("library.yml")))
assert os.path.isfile(os.path.join(database.referencePath, os.path.normpath("library.yml")))

try:
database = RefractiveIndex()
except FileNotFoundError:
print("database not found at default location, checking custom location from \'./refractiveindex_database_location.txt\'")
database_path = ""
with open("refractiveindex_database_location.txt", "r") as f:
database_path = f.readline()

database = RefractiveIndex(databasePath=database_path)
else:
assert os.path.exists(database.referencePath)
assert os.path.exists(os.path.join(database.referencePath, os.path.normpath("library.yml")))
assert os.path.isfile(os.path.join(database.referencePath, os.path.normpath("library.yml")))

finally:
assert os.path.exists(database.referencePath)
assert os.path.exists(os.path.join(database.referencePath, os.path.normpath("library.yml")))
assert os.path.isfile(os.path.join(database.referencePath, os.path.normpath("library.yml")))


def test_getMaterialFilename(self):
database = RefractiveIndex()
try:
database = RefractiveIndex()
except FileNotFoundError:
print("database not found at default location, checking custom location from \'./refractiveindex_database_location.txt\'")
database_path = ""
with open("refractiveindex_database_location.txt", "r") as f:
database_path = f.readline()

database = RefractiveIndex(databasePath=database_path)

for sh in database.catalog:
for b in sh['content']:
if 'DIVIDER' not in b:
Expand All @@ -41,7 +67,16 @@ def test_getMaterialFilename(self):
assert os.path.isfile(os.path.normpath(mat))

def test_getMaterial(self):
database = RefractiveIndex()
try:
database = RefractiveIndex()
except FileNotFoundError:
print("database not found at default location, checking custom location from \'./refractiveindex_database_location.txt\'")
database_path = ""
with open("refractiveindex_database_location.txt", "r") as f:
database_path = f.readline()

database = RefractiveIndex(databasePath=database_path)

for sh in database.catalog:
for b in sh['content']:
if 'DIVIDER' not in b:
Expand Down

0 comments on commit 6c19edc

Please sign in to comment.