3
3
4
4
import pandas as pd
5
5
from pandas .api .extensions import ExtensionArray
6
- from pandas .core .internals .blocks import (
7
- DatetimeTZBlock ,
8
- ExtensionBlock ,
9
- )
6
+ from pandas .core .internals .blocks import EABackedBlock
10
7
from pandas .tests .extension .base .base import BaseExtensionTests
11
8
12
9
@@ -29,14 +26,14 @@ def test_series_constructor(self, data):
29
26
assert result .dtype == data .dtype
30
27
assert len (result ) == len (data )
31
28
if hasattr (result ._mgr , "blocks" ):
32
- assert isinstance (result ._mgr .blocks [0 ], ( ExtensionBlock , DatetimeTZBlock ) )
29
+ assert isinstance (result ._mgr .blocks [0 ], EABackedBlock )
33
30
assert result ._mgr .array is data
34
31
35
32
# Series[EA] is unboxed / boxed correctly
36
33
result2 = pd .Series (result )
37
34
assert result2 .dtype == data .dtype
38
35
if hasattr (result ._mgr , "blocks" ):
39
- assert isinstance (result2 ._mgr .blocks [0 ], ( ExtensionBlock , DatetimeTZBlock ) )
36
+ assert isinstance (result2 ._mgr .blocks [0 ], EABackedBlock )
40
37
41
38
def test_series_constructor_no_data_with_index (self , dtype , na_value ):
42
39
result = pd .Series (index = [1 , 2 , 3 ], dtype = dtype )
@@ -71,15 +68,15 @@ def test_dataframe_constructor_from_dict(self, data, from_series):
71
68
assert result .dtypes ["A" ] == data .dtype
72
69
assert result .shape == (len (data ), 1 )
73
70
if hasattr (result ._mgr , "blocks" ):
74
- assert isinstance (result ._mgr .blocks [0 ], ( ExtensionBlock , DatetimeTZBlock ) )
71
+ assert isinstance (result ._mgr .blocks [0 ], EABackedBlock )
75
72
assert isinstance (result ._mgr .arrays [0 ], ExtensionArray )
76
73
77
74
def test_dataframe_from_series (self , data ):
78
75
result = pd .DataFrame (pd .Series (data ))
79
76
assert result .dtypes [0 ] == data .dtype
80
77
assert result .shape == (len (data ), 1 )
81
78
if hasattr (result ._mgr , "blocks" ):
82
- assert isinstance (result ._mgr .blocks [0 ], ( ExtensionBlock , DatetimeTZBlock ) )
79
+ assert isinstance (result ._mgr .blocks [0 ], EABackedBlock )
83
80
assert isinstance (result ._mgr .arrays [0 ], ExtensionArray )
84
81
85
82
def test_series_given_mismatched_index_raises (self , data ):
0 commit comments