Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore numba.types as public API #5676

Merged
merged 2 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions numba/tests/test_moved_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Tests for moved modules and their redirection from old path
"""
from numba.tests.support import TestCase


class TestMovedModule(TestCase):
"""Testing moved modules in Q1 2020 but were decided to kept as public API
"""
def tests_numba_types(self):
import numba.types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should e.g. from numba.types import containers be explicitly tested too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can add a test. In general, I am only testing a few things because I am already checking for object identity. I don't think that's any reason for it to not work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test added in 2998661

import numba.core.types as types
# The old module is the new module
self.assertIs(numba.types, types)
# Attribute access are there
self.assertIs(numba.types.intp, types.intp)
self.assertIs(numba.types.float64, types.float64)
self.assertIs(numba.types.Array, types.Array)
# Submodule access through old import path is possible
import numba.types.misc
self.assertIs(types.misc, numba.types.misc)
self.assertIs(types.misc.Optional, numba.types.misc.Optional)
3 changes: 3 additions & 0 deletions numba/types/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import sys
import numba.core.types
sys.modules[__name__] = numba.core.types