@@ -152,11 +152,9 @@ def assert_equal(obj1, obj2):
152152]
153153
154154
155- # index_types = ('i1', 'i2', 'i4', 'i8', 'u1', 'u2', 'u4', 'u8')
156- # tensor_types = ('i1', 'i2', 'i4', 'i8', 'u1', 'u2', 'u4', 'u8',
157- # 'f2', 'f4', 'f8')
158- index_types = ('i8' ,)
159- tensor_types = ('i8' ,)
155+ index_types = ('i1' , 'i2' , 'i4' , 'i8' , 'u1' , 'u2' , 'u4' , 'u8' )
156+ tensor_types = ('i1' , 'i2' , 'i4' , 'i8' , 'u1' , 'u2' , 'u4' , 'u8' ,
157+ 'f2' , 'f4' , 'f8' )
160158
161159
162160if sys .version_info >= (3 , 0 ):
@@ -544,10 +542,10 @@ def deserializer(data):
544542def test_sparse_coo_tensor_serialization (index_type , tensor_type ):
545543 tensor_dtype = np .dtype (tensor_type )
546544 index_dtype = np .dtype (index_type )
547- data = np .array ([[1 , 2 , 3 , 4 , 5 , 6 , 7 ]]).T .astype (tensor_dtype )
545+ data = np .array ([[1 , 2 , 3 , 4 , 5 , 6 ]]).T .astype (tensor_dtype )
548546 coords = np .array ([
549- [0 , 0 , 2 , 3 , 1 , 3 , 0 ],
550- [0 , 2 , 0 , 4 , 5 , 5 , 0 ],
547+ [0 , 0 , 2 , 3 , 1 , 3 ],
548+ [0 , 2 , 0 , 4 , 5 , 5 ],
551549 ]).T .astype (index_dtype )
552550 shape = (4 , 6 )
553551 dim_names = ('x' , 'y' )
@@ -558,7 +556,7 @@ def test_sparse_coo_tensor_serialization(index_type, tensor_type):
558556 context = pa .default_serialization_context ()
559557 serialized = pa .serialize (sparse_tensor , context = context ).to_buffer ()
560558 result = pa .deserialize (serialized )
561- result . equals ( sparse_tensor )
559+ assert_equal ( result , sparse_tensor )
562560
563561 data_result , coords_result = result .to_numpy ()
564562 assert np .array_equal (data_result , data )
@@ -572,10 +570,10 @@ def test_sparse_coo_tensor_components_serialization(large_buffer,
572570 index_type , tensor_type ):
573571 tensor_dtype = np .dtype (tensor_type )
574572 index_dtype = np .dtype (index_type )
575- data = np .array ([[1 , 2 , 3 , 4 , 5 , 6 , 7 ]]).T .astype (tensor_dtype )
573+ data = np .array ([[1 , 2 , 3 , 4 , 5 , 6 ]]).T .astype (tensor_dtype )
576574 coords = np .array ([
577- [0 , 0 , 2 , 3 , 1 , 3 , 0 ],
578- [0 , 2 , 0 , 4 , 5 , 5 , 0 ],
575+ [0 , 0 , 2 , 3 , 1 , 3 ],
576+ [0 , 2 , 0 , 4 , 5 , 5 ],
579577 ]).T .astype (index_dtype )
580578 shape = (4 , 6 )
581579 dim_names = ('x' , 'y' )
@@ -587,9 +585,9 @@ def test_sparse_coo_tensor_components_serialization(large_buffer,
587585
588586@pytest .mark .skipif (not coo_matrix , reason = "requires scipy" )
589587def test_scipy_sparse_coo_tensor_serialization ():
590- data = np .array ([1 , 2 , 3 , 4 , 5 , 6 , 7 ])
591- row = np .array ([0 , 0 , 2 , 3 , 1 , 3 , 0 ])
592- col = np .array ([0 , 2 , 0 , 4 , 5 , 5 , 0 ])
588+ data = np .array ([1 , 2 , 3 , 4 , 5 , 6 ])
589+ row = np .array ([0 , 0 , 2 , 3 , 1 , 3 ])
590+ col = np .array ([0 , 2 , 0 , 4 , 5 , 5 ])
593591 shape = (4 , 6 )
594592
595593 sparse_array = coo_matrix ((data , (row , col )), shape = shape )
0 commit comments