Skip to content

Use older dependencies and make tests pass #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mplaltair/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def _normalize_data(chart):
df = pd.DataFrame(_fetch(spec['data']['url']))
elif spec['data'].get('values'):
return
elif spec['data'].get('name'):
datasets = spec.get('datasets', {})
if spec['data'].get('name') in datasets.keys():
return
else:
raise ValidationError('Named Data is provided but no corresponding dataset is found')
else:
raise NotImplementedError('Given data specification is unsupported at the moment.')

Expand Down
7 changes: 7 additions & 0 deletions mplaltair/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pandas as pd
import matplotlib.dates as mdates
import mplaltair._data as _data
from mplaltair._exceptions import ValidationError
import pytest
from vega_datasets import data

Expand All @@ -26,6 +27,12 @@ def test_data_url():
_data._normalize_data(chart)
assert type(chart.data) == pd.DataFrame


def test_named_data():
chart = alt.Chart(alt.NamedData('test-dataset')).mark_point()
with pytest.raises(ValidationError):
_data._normalize_data(chart)

# test date conversion:

df_nonstandard = pd.DataFrame({
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
version='0.0.0',
description="Convert altair objects to Matplotlib Figures",
author="Matplotlib Development Team",
install_requires=['matplotlib>=2.2.0', 'altair>=2'],
install_requires=['matplotlib<3.0', 'altair<3.0','pandas<0.25'],
author_email="[email protected]",
url="https://github.com/matplotlib/mpl-altair",
packages=['mplaltair'],
Expand Down