Skip to content

Fix ImportErrors not being raised#150

Merged
lmmentel merged 3 commits intomasterfrom
bugfix/no-importerror
May 21, 2024
Merged

Fix ImportErrors not being raised#150
lmmentel merged 3 commits intomasterfrom
bugfix/no-importerror

Conversation

@lmmentel
Copy link
Copy Markdown
Owner

@lmmentel lmmentel commented May 13, 2024

fixes #149

This should ideally work for the following cases:

  1. ✔️ lazy import of elements by symbol
from mendeleev import C
  1. ✔️ import any existing module directly from mendeleev
from mendeleev import fetch
  1. ✔️ raise an exception for non-existing objects
from mendeleev import whatever
ImportError: cannot import name 'whatever' from 'mendeleev' ...

@lmmentel lmmentel requested review from kalvdans and paulromano May 13, 2024 21:45
import mendeleev.fetch # noqa: F401
import mendeleev.vis # noqa: F401
import mendeleev.ion # noqa: F401
import mendeleev.mendeleev # noqa: F401

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from'

Module 'mendeleev' is imported with both 'import' and 'import from'. Module 'mendeleev.mendeleev' is imported with both 'import' and 'import from'.
@lmmentel lmmentel marked this pull request as ready for review May 18, 2024 12:17
@kalvdans
Copy link
Copy Markdown
Collaborator

Tests looks good. Also test from mendeleev import C please!

@lmmentel lmmentel merged commit 76460b6 into master May 21, 2024
@lmmentel lmmentel deleted the bugfix/no-importerror branch May 21, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportErrors are not thrown for missing objects

2 participants