diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2010-04-27 20:54:08 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2010-04-27 20:54:08 +0000 |
commit | 413220795d7f928bf150f926fe286a5e0dc36cce (patch) | |
tree | 63d5c7f171613dbee21958d91c252beac6577e25 /numpy | |
parent | 1e659b5ab591d47449b73481f2335a7a850495b7 (diff) | |
download | numpy-413220795d7f928bf150f926fe286a5e0dc36cce.tar.gz |
BUG: Fix missing import for datatime_data.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/tests/test_type_check.py | 7 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index 01494594b..751392fef 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -375,5 +375,12 @@ class TestArrayConversion(TestCase): assert issubdtype(a.dtype,float) +class TestDateTimeData: + + def test_basic(self): + a = array(['1980-03-23'], dtype=datetime64) + assert_equal(datetime_data(a.dtype), ('us', 1, 1, 1)) + + if __name__ == "__main__": run_module_suite() diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 7c88b192d..05070b3ba 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -619,6 +619,7 @@ def datetime_data(dtype): ('den', ctypes.c_int), ('events', ctypes.c_int)] + import sys if sys.version_info[:2] >= (3,1): func = ctypes.pythonapi.PyCapsule_GetPointer func.argtypes = [ctypes.py_object, ctypes.c_char_p] |