REF: simplify logic in assert_produces_warning (#38637)
REF: simplify logic in assert_produces_warning (#38637)


jorisvandenbossche/pandas,jreback/pandas,pandas-dev/pandas,pandas-dev/pandas,jorisvandenbossche/pandas,datapythonista/pandas,jorisvandenbossche/pandas,jreback/pandas,jorisvandenbossche/pandas,jreback/pandas,rs2/pandas,pandas-dev/pandas,datapythonista/pandas,dsm054/pandas,dsm054/pandas,pandas-dev/pandas,datapythonista/pandas,jreback/pandas,rs2/pandas,gfyoung/pandas,gfyoung/pandas,gfyoung/pandas,jreback/pandas,gfyoung/pandas,rs2/pandas,dsm054/pandas,rs2/pandas,datapythonista/pandas,dsm054/pandas,gfyoung/pandas,dsm054/pandas