test_stat_calculate_methods.py 文件源码

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

项目:plotnine 作者: has2k1 项目源码 文件源码
def test_stat_bin():
    x = [1, 2, 3]
    y = [1, 2, 3]
    df = pd.DataFrame({'x': x, 'y': y})

    # About the default bins
    gg = ggplot(aes(x='x'), df) + stat_bin()

    if not six.PY2:
        # Test fails on PY2 when all the tests are run,
        # but not when only this test module is run
        with pytest.warns(None) as record:
            gg.draw_test()

        res = ('bins' in str(item.message).lower() for item in record)
        assert any(res)

    # About the ignoring the y aesthetic
    gg = ggplot(aes(x='x', y='y'), df) + stat_bin()
    with pytest.raises(PlotnineError):
        gg.draw_test()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号