Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 29, 2024
1 parent 9f01b57 commit 6de6fed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
11 changes: 8 additions & 3 deletions atomistics/referencedata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from atomistics.referencedata.wiki import get_experimental_elastic_property_wikipedia

try:
from atomistics.referencedata.mendeleevdb import get_chemical_information_from_mendeleev, get_chemical_information_from_wolframalpha
from atomistics.referencedata.mendeleevdb import (
get_chemical_information_from_mendeleev,
get_chemical_information_from_wolframalpha,
)
except ImportError:
__all__ = []
else:
__all__ = [get_chemical_information_from_mendeleev, get_chemical_information_from_wolframalpha]
__all__ = [
get_chemical_information_from_mendeleev,
get_chemical_information_from_wolframalpha,
]


__all__ += [get_experimental_elastic_property_wikipedia]

16 changes: 13 additions & 3 deletions tests/test_referencedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@


try:
from atomistics.referencedata import get_chemical_information_from_mendeleev, get_chemical_information_from_wolframalpha
from atomistics.referencedata import (
get_chemical_information_from_mendeleev,
get_chemical_information_from_wolframalpha,
)

mendeleev_not_available = False
except ImportError:
mendeleev_not_available = True


class TestReferenceData(unittest.TestCase):
@unittest.skipIf(mendeleev_not_available, "mendeleev is not installed, so the mendeleev tests are skipped.")
@unittest.skipIf(
mendeleev_not_available,
"mendeleev is not installed, so the mendeleev tests are skipped.",
)
def test_get_chemical_information_from_mendeleev(self):
al_data = get_chemical_information_from_mendeleev(chemical_symbol="Al")
self.assertEqual(al_data["atomic_number"], 13)

@unittest.skipIf(mendeleev_not_available, "mendeleev is not installed, so the mendeleev tests are skipped.")
@unittest.skipIf(
mendeleev_not_available,
"mendeleev is not installed, so the mendeleev tests are skipped.",
)
def test_get_chemical_information_from_wolframalpha(self):
al_data = get_chemical_information_from_wolframalpha(chemical_element="Al")
self.assertEqual(al_data["latticeconstant"], "(404.95, 404.95, 404.95)")
Expand Down

0 comments on commit 6de6fed

Please sign in to comment.