<ul>
<li><a href="https://github.com/pandas-dev/pandas/blob/master/pandas/_testing.py#L2527" rel="nofollow noreferrer">^{<cd1>}</a>的源代码声明它是<a href="https://docs.python.org/3/library/warnings.html#warnings.catch_warnings" rel="nofollow noreferrer">^{<cd2>}</a>的包装器。
<ul>
<li>似乎使用<code>warnings.catch_warnings</code>是最好的选择</李>
<li><a href="https://github.com/pandas-dev/pandas/blob/master/pandas/_testing.py#L2567" rel="nofollow noreferrer">Examples</a></li>
</ul>
</li>
<li>从熊猫1.0.0发行说明:
<ul>
<li><code>pandas.util.testing</code>模块已被弃用。在<a href="https://pandas.pydata.org/pandas-docs/version/1.0.0/reference/general_utility_functions.html#api-general-testing" rel="nofollow noreferrer">Testing functions</a>(<a href="https://github.com/pandas-dev/pandas/issues/16232" rel="nofollow noreferrer">GH16232</a>)中使用<code>pandas.testing</code>中的公共API</李>
</ul>
</li>
<li>根据<a href="https://pandas.pydata.org/pandas-docs/version/0.25.0/development/contributing.html#testing-warnings" rel="nofollow noreferrer">pandas 0.25 Test Warnings</a>的<code>pandas.util.testing.assert_produces_warning</code>
<ul>
<li><em>我们更喜欢使用<a href="https://docs.pytest.org/en/stable/reference.html#pytest-warns" rel="nofollow noreferrer">^{<cd7>}</a>上下文管理器,因为我们检查警告的stacklevel设置是否正确</em></li>
</ul>
</li>
</ul>