@@ -62,13 +62,18 @@ def test_types_concat_none() -> None:
62
62
check (
63
63
assert_type (pd .concat ([None , series , df ], axis = 1 ), pd .DataFrame ), pd .DataFrame
64
64
)
65
+ check (assert_type (pd .concat ([None , series , df ]), pd .DataFrame ), pd .DataFrame )
65
66
66
67
check (assert_type (pd .concat ({"a" : None , "b" : series }), pd .Series ), pd .Series )
67
68
check (assert_type (pd .concat ({"a" : None , "b" : df }), pd .DataFrame ), pd .DataFrame )
68
69
check (
69
70
assert_type (pd .concat ({"a" : None , "b" : series , "c" : df }, axis = 1 ), pd .DataFrame ),
70
71
pd .DataFrame ,
71
72
)
73
+ check (
74
+ assert_type (pd .concat ({"a" : None , "b" : series , "c" : df }), pd .DataFrame ),
75
+ pd .DataFrame ,
76
+ )
72
77
73
78
if TYPE_CHECKING_INVALID_USAGE :
74
79
# using assert_type as otherwise the second call would not be type-checked
@@ -77,8 +82,8 @@ def test_types_concat_none() -> None:
77
82
78
83
79
84
def test_types_concat () -> None :
80
- s : pd . Series = pd .Series ([0 , 1 , - 10 ])
81
- s2 : pd . Series = pd .Series ([7 , - 5 , 10 ])
85
+ s = pd .Series ([0 , 1 , - 10 ])
86
+ s2 = pd .Series ([7 , - 5 , 10 ])
82
87
83
88
check (assert_type (pd .concat ([s , s2 ]), pd .Series ), pd .Series )
84
89
check (assert_type (pd .concat ([s , s2 ], axis = 1 ), pd .DataFrame ), pd .DataFrame )
@@ -166,6 +171,9 @@ def test_types_concat() -> None:
166
171
adict = {"a" : df , 2 : df2 }
167
172
check (assert_type (pd .concat (adict ), pd .DataFrame ), pd .DataFrame )
168
173
174
+ data : pd .DataFrame | pd .Series = pd .Series ()
175
+ check (assert_type (pd .concat ([pd .DataFrame (), data ]), pd .DataFrame ), pd .DataFrame )
176
+
169
177
170
178
def test_concat_args () -> None :
171
179
df = pd .DataFrame (data = {"col1" : [1 , 2 ], "col2" : [3 , 4 ]})
0 commit comments