summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/__init__.py2
-rw-r--r--numpy/tests/test_public_api.py6
2 files changed, 7 insertions, 1 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 00c4a3d78..c5c58b020 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -215,7 +215,7 @@ else:
"{!r}".format(__name__, attr))
def __dir__():
- return list(globals().keys()) + ['Tester', 'testing']
+ return list(globals().keys() | {'Tester', 'testing'})
else:
# We don't actually use this ourselves anymore, but I'm not 100% sure that
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py
index b4aa7ec3d..27ff87f49 100644
--- a/numpy/tests/test_public_api.py
+++ b/numpy/tests/test_public_api.py
@@ -94,6 +94,12 @@ def test_import_lazy_import(name):
assert name in dir(np)
+def test_dir_testing():
+ """Assert that output of dir has only one "testing/tester"
+ attribute without duplicate"""
+ assert len(dir(np)) == len(set(dir(np)))
+
+
def test_numpy_linalg():
bad_results = check_dir(np.linalg)
assert bad_results == {}