小编Mih*_*hai的帖子

将工具提示添加到散景堆积条形图

考虑垂直堆积条形图,其中每列由多个条形(段)组成.是否可以在每个细分上添加工具提示?目前,相同的工具提示附加到组成列的所有段.

from bokeh.core.properties import value
from bokeh.io import show, output_file
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.models import HoverTool

fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']
years = ["2015", "2016", "2017"]
colors = ["#c9d9d3", "#718dbf", "#e84d60"]

data = {'fruits' : fruits,
        '2015'   : [2, 1, 4, 3, 2, 4],
        '2016'   : [5, 3, 4, 2, 4, 6],
        '2017'   : [3, 2, 4, 4, 5, 3]}

source = ColumnDataSource(data=data)

p = figure(x_range=fruits, plot_height=250, title="Fruit Counts by Year", …
Run Code Online (Sandbox Code Playgroud)

bokeh

7
推荐指数
1
解决办法
1158
查看次数

检查是否使用 pytest 引发了期望

作为异常测试处理的新手,我想知道如何检查是否提出了断言。

一个.py

class SomeError(Exception):
    pass

class SomeClass(object):
    def __init__(self):
        ...
        raise SomeError
        ...
Run Code Online (Sandbox Code Playgroud)

test_a.py

from a.a import SomeClass

def test_some_exception_raised():
    ?
Run Code Online (Sandbox Code Playgroud)

应该有什么断言来检查是否SomeError被提出?我正在使用 pytest。

python testing pytest

4
推荐指数
1
解决办法
6332
查看次数

标签 统计

bokeh ×1

pytest ×1

python ×1

testing ×1