test_stat.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:plotnine 作者: has2k1 项目源码 文件源码
def test_removes_infinite_values():
    df = mtcars.copy()
    df.loc[[0, 5], 'wt'] = [np.inf, -np.inf]
    p = ggplot(df, aes(x='wt')) + geom_bar()

    with pytest.warns(UserWarning) as record:
        p._build()

    def removed_2_row_with_infinites(record):
        for item in record:
            msg = str(item.message).lower()
            if '2 rows' in msg and 'non-finite' in msg:
                return True
        return False

    assert removed_2_row_with_infinites(record)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号