def test_data_timeUnit_field_temporal_fail(): """"'Passes' if it raises a NotImplementedError""" chart = alt.Chart(df).mark_point().encode( alt.X(field='combination', type='temporal', timeUnit='month')) for channel in chart.to_dict()['encoding']: with pytest.raises(NotImplementedError): data = _data._locate_channel_data(chart, channel)
def test_data_aggregate_quantitative_fail(column): """"'Passes' if it raises a NotImplementedError""" chart = alt.Chart(df).mark_point().encode( alt.X(field=column, type='quantitative', aggregate='average')) for channel in chart.to_dict()['encoding']: with pytest.raises(NotImplementedError): data = _data._locate_channel_data(chart, channel)
def test_data_timeUnit_shorthand_temporal_fail(): chart = alt.Chart(df).mark_point().encode(alt.X('month(combination):T')) for channel in chart.to_dict()['encoding']: with pytest.raises(NotImplementedError): data = _data._locate_channel_data(chart, channel)
def test_data_value_quantitative(): chart = alt.Chart(df).mark_point().encode(opacity=alt.value(0.5)) for channel in chart.to_dict()['encoding']: data = _data._locate_channel_data(chart, channel) assert data == 0.5
def test_data_shorthand_quantitative(column): chart = alt.Chart(df).mark_point().encode(alt.X(column)) for channel in chart.to_dict()['encoding']: data = _data._locate_channel_data(chart, channel) assert list(data) == list(df[column].values)