Skip to content

Commit 00c46ed

Browse files
committed
Fix test_data coverage
1 parent a0ce422 commit 00c46ed

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

mplaltair/tests/test_data.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,27 @@ def test_data_value_quantitative():
4141

4242

4343
@pytest.mark.parametrize("column", ['a', 'b', 'c'])
44-
@pytest.mark.xfail(raises=NotImplementedError)
45-
def test_data_aggregate_quantitative(column):
44+
def test_data_aggregate_quantitative_fail(column):
45+
""""'Passes' if it raises a NotImplementedError"""
4646
chart = alt.Chart(df).mark_point().encode(alt.X(field=column, type='quantitative', aggregate='average'))
4747
for channel in chart.to_dict()['encoding']:
48-
data = _data._locate_channel_data(chart, channel)
48+
with pytest.raises(NotImplementedError):
49+
data = _data._locate_channel_data(chart, channel)
4950

5051

51-
@pytest.mark.xfail(raises=NotImplementedError)
52-
def test_data_timeUnit_shorthand_temporal():
52+
def test_data_timeUnit_shorthand_temporal_fail():
5353
chart = alt.Chart(df).mark_point().encode(alt.X('month(combination):T'))
5454
for channel in chart.to_dict()['encoding']:
55-
data = _data._locate_channel_data(chart, channel)
55+
with pytest.raises(NotImplementedError):
56+
data = _data._locate_channel_data(chart, channel)
5657

5758

58-
@pytest.mark.xfail(raises=NotImplementedError)
59-
def test_data_timeUnit_field_temporal():
59+
def test_data_timeUnit_field_temporal_fail():
60+
""""'Passes' if it raises a NotImplementedError"""
6061
chart = alt.Chart(df).mark_point().encode(alt.X(field='combination', type='temporal', timeUnit='month'))
6162
for channel in chart.to_dict()['encoding']:
62-
data = _data._locate_channel_data(chart, channel)
63+
with pytest.raises(NotImplementedError):
64+
data = _data._locate_channel_data(chart, channel)
6365

6466

6567
# _locate_channel_dtype() tests
@@ -74,9 +76,9 @@ def test_data_dtype(column, expected):
7476
assert dtype == expected
7577

7678

77-
@pytest.mark.xfail(raises=NotImplementedError)
7879
def test_data_dtype_fail():
80+
""""'Passes' if it raises a NotImplementedError"""
7981
chart = alt.Chart(df).mark_point().encode(opacity=alt.value(.5))
8082
for channel in chart.to_dict()['encoding']:
81-
dtype = _data._locate_channel_dtype(chart, channel)
82-
assert dtype == 'quantitative'
83+
with pytest.raises(NotImplementedError):
84+
dtype = _data._locate_channel_dtype(chart, channel)

0 commit comments

Comments
 (0)