Skip to content

Commit a55659c

Browse files
committed
handle no warning
1 parent c05306d commit a55659c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/util/testing.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2651,8 +2651,11 @@ class for all warnings. To check that no warning is returned,
26512651
pass
26522652

26532653
saw_warning = False
2654-
if filter_level:
2654+
if expected_warning and filter_level:
26552655
warnings.filterwarnings(filter_level, message, expected_warning)
2656+
elif filter_level:
2657+
# no expected warnings.
2658+
warnings.simplefilter(filter_level)
26562659
yield w
26572660
extra_warnings = []
26582661

0 commit comments

Comments
 (0)