@@ -799,7 +799,7 @@ def test_chained_union(self, sort):
799
799
j1 = Index ([1 , 2 ], name = 'j1' )
800
800
j2 = Index ([], name = 'j2' )
801
801
j3 = Index ([], name = 'j3' )
802
- with tm .assert_produces_warning (warning ):
802
+ with tm .assert_produces_warning (warning , check_stacklevel = False ):
803
803
union = j1 .union (j2 .union (j3 , sort = sort ), sort = sort )
804
804
expected = j1 .union (j2 , sort = sort ).union (j3 , sort = sort )
805
805
tm .assert_index_equal (union , expected )
@@ -874,7 +874,7 @@ def test_union_from_iterables(self, klass, sort):
874
874
case = klass (second .values )
875
875
876
876
warning = FutureWarning if sort is None else None
877
- with tm .assert_produces_warning (warning ):
877
+ with tm .assert_produces_warning (warning , check_stacklevel = False ):
878
878
result = first .union (case , sort = sort )
879
879
880
880
if sort is not False :
@@ -895,8 +895,7 @@ def test_union_identity(self, sort):
895
895
896
896
# This should no longer be the same object, since [] is not consistent,
897
897
# both objects will be recast to dtype('O')
898
- union = first .union ([], sort = sort )
899
- with tm .assert_produces_warning (warning ):
898
+ with tm .assert_produces_warning (warning , check_stacklevel = False ):
900
899
union = first .union ([], sort = sort )
901
900
assert (union is first ) is (not sort )
902
901
@@ -2263,7 +2262,7 @@ def test_union_different_type_base(self, klass):
2263
2262
first = index [3 :]
2264
2263
second = index [:5 ]
2265
2264
2266
- with tm .assert_produces_warning (FutureWarning ):
2265
+ with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
2267
2266
result = first .union (klass (second .values ))
2268
2267
2269
2268
assert tm .equalContents (result , index )
0 commit comments