@@ -21,7 +21,7 @@ def test_can_convert_to_records_without_objects_returns_false_on_exception_in_to
21
21
22
22
def test_can_convert_to_records_without_objects_returns_false_when_records_have_object_dtype ():
23
23
store = PandasStore ()
24
- store .to_records = Mock (return_value = np .array (['a' , 'b' , None , 'd' ]))
24
+ store .to_records = Mock (return_value = ( np .array (['a' , 'b' , None , 'd' ]), None ))
25
25
26
26
with patch ('arctic.store._pandas_ndarray_store.log' ) as mock_log :
27
27
assert store .can_convert_to_records_without_objects (sentinel .df , 'my_symbol' ) is False
@@ -32,8 +32,8 @@ def test_can_convert_to_records_without_objects_returns_false_when_records_have_
32
32
33
33
def test_can_convert_to_records_without_objects_returns_false_when_records_have_arrays_in_them ():
34
34
store = PandasStore ()
35
- store .to_records = Mock (return_value = np .rec .array ([(1356998400000000000L , ['A' , 'BC' ])],
36
- dtype = [('index' , '<M8[ns]' ), ('values' , 'S2' , (2 ,))]))
35
+ store .to_records = Mock (return_value = ( np .rec .array ([(1356998400000000000L , ['A' , 'BC' ])],
36
+ dtype = [('index' , '<M8[ns]' ), ('values' , 'S2' , (2 ,))]), None ))
37
37
38
38
with patch ('arctic.store._pandas_ndarray_store.log' ) as mock_log :
39
39
assert store .can_convert_to_records_without_objects (sentinel .df , 'my_symbol' ) is False
@@ -44,8 +44,8 @@ def test_can_convert_to_records_without_objects_returns_false_when_records_have_
44
44
45
45
def test_can_convert_to_records_without_objects_returns_true_otherwise ():
46
46
store = PandasStore ()
47
- store .to_records = Mock (return_value = np .rec .array ([(1356998400000000000L , 'a' )],
48
- dtype = [('index' , '<M8[ns]' ), ('values' , 'S2' )]))
47
+ store .to_records = Mock (return_value = ( np .rec .array ([(1356998400000000000L , 'a' )],
48
+ dtype = [('index' , '<M8[ns]' ), ('values' , 'S2' )]), None ))
49
49
50
50
with patch ('arctic.store._pandas_ndarray_store.log' ) as mock_log :
51
51
assert store .can_convert_to_records_without_objects (sentinel .df , 'my_symbol' ) is True
@@ -54,15 +54,6 @@ def test_can_convert_to_records_without_objects_returns_true_otherwise():
54
54
store .to_records .assert_called_once_with (sentinel .df )
55
55
56
56
57
- def test_to_records_raises_when_object_dtypes_present ():
58
- store = PandasDataFrameStore ()
59
- df = pd .DataFrame (data = dict (A = ['a' , 'b' , None , 'c' ], B = [1. , 2. , 3. , 4. ]), index = range (4 ))
60
- with raises (TypeError ) as e :
61
- store .to_records (df )
62
-
63
- assert "Cannot change data-type for object array." in str (e )
64
-
65
-
66
57
def test_panel_converted_to_dataframe_and_stacked_to_write ():
67
58
store = PandasPanelStore ()
68
59
panel = Mock (shape = (1 , 2 , 3 ), axes = [Mock (names = ['n%d' % i ]) for i in range (3 )])
0 commit comments