|
21 | 21 | "s": [50, 100, 200.0], "alpha": [.1, .5, .8], "shape": [1, 2, 3], "fill": [1, 2, 3] |
22 | 22 | }) |
23 | 23 |
|
| 24 | + |
| 25 | +def test_encoding_not_provided(): |
| 26 | + chart_spec = alt.Chart(df).mark_point() |
| 27 | + with pytest.raises(ValueError): |
| 28 | + convert(chart_spec) |
| 29 | + |
| 30 | +def test_invalid_encodings(): |
| 31 | + chart_spec = alt.Chart(df).encode(x2='quant').mark_point() |
| 32 | + with pytest.raises(ValueError): |
| 33 | + convert(chart_spec) |
| 34 | + |
24 | 35 | @pytest.mark.parametrize('channel', ['quant', 'ord', 'nom']) |
25 | 36 | def test_convert_x_success(channel): |
26 | 37 | chart_spec = alt.Chart(df).encode(x=channel).mark_point() |
@@ -55,12 +66,12 @@ def test_convert_y_fail(): |
55 | 66 | with pytest.raises(KeyError): |
56 | 67 | convert(chart_spec) |
57 | 68 |
|
58 | | -@pytest.mark.xfail(raises=NotImplementedError, reason="It doesn't make sense to have x2 and y2 on scatter plots") |
| 69 | +@pytest.mark.xfail(raises=ValueError, reason="It doesn't make sense to have x2 and y2 on scatter plots") |
59 | 70 | def test_quantitative_x2_y2(): |
60 | 71 | chart = alt.Chart(df_quant).mark_point().encode(alt.X('a'), alt.Y('b'), alt.X2('c'), alt.Y2('alpha')) |
61 | 72 | convert(chart) |
62 | 73 |
|
63 | | -@pytest.mark.xfail(raises=NotImplementedError) |
| 74 | +@pytest.mark.xfail(raises=ValueError) |
64 | 75 | @pytest.mark.parametrize("column", ["years", "months", "days", "hrs", "combination"]) |
65 | 76 | def test_convert_x2_y2_fail_temporal(column): |
66 | 77 | chart = alt.Chart(df).mark_point().encode(alt.X2(column), alt.Y2(column)) |
|
0 commit comments