From b5b5b825b7da84ad66378700cd451e4f28f03004 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Sun, 6 Mar 2016 19:58:14 -0800 Subject: [PATCH] Failing test stubs, raise on null array --- python/arrow/array.pyx | 10 ++++++++-- python/arrow/tests/test_convert_builtin.py | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/python/arrow/array.pyx b/python/arrow/array.pyx index 905d11d9ab257..cf396da0ef962 100644 --- a/python/arrow/array.pyx +++ b/python/arrow/array.pyx @@ -95,9 +95,15 @@ cdef dict _array_classes = { } cdef object box_arrow_array(const shared_ptr[CArray]& sp_array): - cdef LogicalType type = sp_array.get().type().get().type + if sp_array.get() == NULL: + raise ValueError('Array was NULL') - cdef Array arr = _array_classes[type]() + cdef CDataType* data_type = sp_array.get().type().get() + + if data_type == NULL: + raise ValueError('Array data type was NULL') + + cdef Array arr = _array_classes[data_type.type]() arr.init(sp_array) return arr diff --git a/python/arrow/tests/test_convert_builtin.py b/python/arrow/tests/test_convert_builtin.py index f5e8315934235..f88e3cdad5ee3 100644 --- a/python/arrow/tests/test_convert_builtin.py +++ b/python/arrow/tests/test_convert_builtin.py @@ -21,5 +21,19 @@ class TestConvertList(unittest.TestCase): - def test_list_convert(self): + def test_boolean(self): + pass + + def test_integer(self): + arr = arrow.from_list([1, 2, 3]) + assert len(arr) == 3 + assert arr.type == arrow.int64() + + def test_double(self): + pass + + def test_string(self): + pass + + def test_list_of_int(self): pass