diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 066747a6b..41945f888 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,38 +7,38 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] name: Python ${{ matrix.python-version }} steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Set Up Chromedriver - run: | - sudo apt-get update - sudo apt-get --only-upgrade install google-chrome-stable - sudo apt-get -yqq install chromium-chromedriver - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[dev] - pip install "selenium<4.3.0" - pip install altair_saver vl-convert-python - pip install git+https://github.com/altair-viz/altair_viewer.git - - name: Test with pytest - run: | - pytest --doctest-modules altair - - name: Selected tests without vl-convert-python - run: | - pip uninstall vl-convert-python --yes - pytest -m save_engine --doctest-modules altair - - name: Selected tests without vl-convert-python and altair_saver - run: | - pip uninstall altair_saver --yes - pytest -m save_engine --doctest-modules altair - - name: Selected tests with vl-convert-python and without altair_saver - run: | - pip install vl-convert-python - pytest -m save_engine --doctest-modules altair \ No newline at end of file + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Set Up Chromedriver + run: | + sudo apt-get update + sudo apt-get --only-upgrade install google-chrome-stable + sudo apt-get -yqq install chromium-chromedriver + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev] + pip install "selenium<4.3.0" + pip install altair_saver vl-convert-python + pip install git+https://github.com/altair-viz/altair_viewer.git + - name: Test with pytest + run: | + pytest --doctest-modules tests + - name: Selected tests without vl-convert-python + run: | + pip uninstall vl-convert-python --yes + pytest -m save_engine --doctest-modules tests + - name: Selected tests without vl-convert-python and altair_saver + run: | + pip uninstall altair_saver --yes + pytest -m save_engine --doctest-modules tests + - name: Selected tests with vl-convert-python and without altair_saver + run: | + pip install vl-convert-python + pytest -m save_engine --doctest-modules tests diff --git a/Makefile b/Makefile index 70fb25d2d..92669bbac 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ install: test : black . --check flake8 . --statistics - python -m pytest --pyargs --doctest-modules altair + python -m pytest --pyargs --doctest-modules tests test-coverage: python -m pytest --pyargs --doctest-modules --cov=altair --cov-report term altair diff --git a/altair/__init__.py b/altair/__init__.py index 954f5c47e..fe7539bfd 100644 --- a/altair/__init__.py +++ b/altair/__init__.py @@ -2,7 +2,6 @@ __version__ = "4.3.0.dev0" from .vegalite import * -from . import examples def load_ipython_extension(ipython): diff --git a/altair/examples/__init__.py b/altair/examples/__init__.py deleted file mode 100644 index d30aedbdf..000000000 --- a/altair/examples/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - - -def iter_examples(): - """Iterate over the examples in this directory. - - Each item is a dict with the following keys: - - "name" : the unique name of the example - - "filename" : the full file path to the example - """ - example_dir = os.path.abspath(os.path.dirname(__file__)) - for filename in os.listdir(example_dir): - name, ext = os.path.splitext(filename) - if name.startswith('_') or ext != '.py': - continue - yield {'name': name, - 'filename': os.path.join(example_dir, filename)} diff --git a/altair/utils/core.py b/altair/utils/core.py index 162caee30..53785b174 100644 --- a/altair/utils/core.py +++ b/altair/utils/core.py @@ -14,7 +14,7 @@ import pandas as pd import numpy as np -from .schemapi import SchemaBase, Undefined +from altair.utils.schemapi import SchemaBase, Undefined try: from pandas.api.types import infer_dtype as _infer_dtype diff --git a/doc/conf.py b/doc/conf.py index 1e27dc606..cd850dc3c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -36,9 +36,9 @@ "sphinx.ext.coverage", "sphinx.ext.githubpages", "numpydoc.numpydoc", - "altair.sphinxext.altairplot", - "altair.sphinxext.altairgallery", - "altair.sphinxext.schematable", + "sphinxext.altairplot", + "sphinxext.altairgallery", + "sphinxext.schematable", # "sphinxext.rediraffe", ] @@ -84,7 +84,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -154,12 +154,10 @@ "type": "fontawesome", }, ], - "header_links_before_dropdown": 6 + "header_links_before_dropdown": 6, } -html_context = { - "default_mode": "light" -} +html_context = {"default_mode": "light"} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] diff --git a/pyproject.toml b/pyproject.toml index 79a44a49e..bb6656184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ exclude = ''' | build | dist | doc - | altair/examples + | tests/examples_arguments_syntax | altair/vega/v\d*/schema | altair/vegalite/v\d*/schema )/ diff --git a/requirements_dev.txt b/requirements_dev.txt index 407aeda4b..f0963a53a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -3,6 +3,7 @@ docutils ipython flake8 pytest +pytest-cov sphinx mistune<2.0.0 # necessary for m2r v0.2 m2r diff --git a/setup.cfg b/setup.cfg index 49493bbe4..81038d2d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ exclude = .git, build, __pycache__, - altair/examples + tests/examples_arguments_syntax altair/vega*/v?/schema [metadata] diff --git a/altair/examples/tests/__init__.py b/sphinxext/__init__.py similarity index 100% rename from altair/examples/tests/__init__.py rename to sphinxext/__init__.py diff --git a/altair/sphinxext/altairgallery.py b/sphinxext/altairgallery.py similarity index 98% rename from altair/sphinxext/altairgallery.py rename to sphinxext/altairgallery.py index 06e2e1b32..2b62dcba4 100644 --- a/altair/sphinxext/altairgallery.py +++ b/sphinxext/altairgallery.py @@ -22,7 +22,7 @@ create_generic_image, ) from altair.utils.execeval import eval_block -from altair.examples import iter_examples +from tests.examples_arguments_syntax import iter_examples_arguments_syntax EXAMPLE_MODULE = "altair.examples" @@ -165,7 +165,7 @@ def save_example_pngs(examples, image_dir, make_thumbnails=True): def populate_examples(**kwds): """Iterate through Altair examples and extract code""" - examples = sorted(iter_examples(), key=itemgetter("name")) + examples = sorted(iter_examples_arguments_syntax(), key=itemgetter("name")) for example in examples: docstring, category, code, lineno = get_docstring_and_rest(example["filename"]) diff --git a/altair/sphinxext/altairplot.py b/sphinxext/altairplot.py similarity index 100% rename from altair/sphinxext/altairplot.py rename to sphinxext/altairplot.py diff --git a/altair/sphinxext/schematable.py b/sphinxext/schematable.py similarity index 100% rename from altair/sphinxext/schematable.py rename to sphinxext/schematable.py diff --git a/altair/sphinxext/utils.py b/sphinxext/utils.py similarity index 100% rename from altair/sphinxext/utils.py rename to sphinxext/utils.py diff --git a/altair/expr/tests/__init__.py b/tests/__init__.py similarity index 100% rename from altair/expr/tests/__init__.py rename to tests/__init__.py diff --git a/tests/examples_arguments_syntax/__init__.py b/tests/examples_arguments_syntax/__init__.py new file mode 100644 index 000000000..a9575575a --- /dev/null +++ b/tests/examples_arguments_syntax/__init__.py @@ -0,0 +1,19 @@ +import os + + +def iter_examples_arguments_syntax(): + """Iterate over the examples in this directory. + + Each item is a dict with the following keys: + - "name" : the unique name of the example + - "filename" : the full file path to the example + """ + examples_arguments_syntax_dir = os.path.abspath(os.path.dirname(__file__)) + for filename in os.listdir(examples_arguments_syntax_dir): + name, ext = os.path.splitext(filename) + if name.startswith("_") or ext != ".py": + continue + yield { + "name": name, + "filename": os.path.join(examples_arguments_syntax_dir, filename), + } diff --git a/altair/examples/airport_connections.py b/tests/examples_arguments_syntax/airport_connections.py similarity index 100% rename from altair/examples/airport_connections.py rename to tests/examples_arguments_syntax/airport_connections.py diff --git a/altair/examples/annual_weather_heatmap.py b/tests/examples_arguments_syntax/annual_weather_heatmap.py similarity index 100% rename from altair/examples/annual_weather_heatmap.py rename to tests/examples_arguments_syntax/annual_weather_heatmap.py diff --git a/altair/examples/anscombe_plot.py b/tests/examples_arguments_syntax/anscombe_plot.py similarity index 100% rename from altair/examples/anscombe_plot.py rename to tests/examples_arguments_syntax/anscombe_plot.py diff --git a/altair/examples/area_chart_gradient.py b/tests/examples_arguments_syntax/area_chart_gradient.py similarity index 100% rename from altair/examples/area_chart_gradient.py rename to tests/examples_arguments_syntax/area_chart_gradient.py diff --git a/altair/examples/bar_and_line_with_dual_axis.py b/tests/examples_arguments_syntax/bar_and_line_with_dual_axis.py similarity index 100% rename from altair/examples/bar_and_line_with_dual_axis.py rename to tests/examples_arguments_syntax/bar_and_line_with_dual_axis.py diff --git a/altair/examples/bar_chart_horizontal.py b/tests/examples_arguments_syntax/bar_chart_horizontal.py similarity index 100% rename from altair/examples/bar_chart_horizontal.py rename to tests/examples_arguments_syntax/bar_chart_horizontal.py diff --git a/altair/examples/bar_chart_sorted.py b/tests/examples_arguments_syntax/bar_chart_sorted.py similarity index 100% rename from altair/examples/bar_chart_sorted.py rename to tests/examples_arguments_syntax/bar_chart_sorted.py diff --git a/altair/examples/bar_chart_trellis_compact.py b/tests/examples_arguments_syntax/bar_chart_trellis_compact.py similarity index 100% rename from altair/examples/bar_chart_trellis_compact.py rename to tests/examples_arguments_syntax/bar_chart_trellis_compact.py diff --git a/altair/examples/bar_chart_with_highlighted_bar.py b/tests/examples_arguments_syntax/bar_chart_with_highlighted_bar.py similarity index 100% rename from altair/examples/bar_chart_with_highlighted_bar.py rename to tests/examples_arguments_syntax/bar_chart_with_highlighted_bar.py diff --git a/altair/examples/bar_chart_with_highlighted_segment.py b/tests/examples_arguments_syntax/bar_chart_with_highlighted_segment.py similarity index 100% rename from altair/examples/bar_chart_with_highlighted_segment.py rename to tests/examples_arguments_syntax/bar_chart_with_highlighted_segment.py diff --git a/altair/examples/bar_chart_with_labels.py b/tests/examples_arguments_syntax/bar_chart_with_labels.py similarity index 100% rename from altair/examples/bar_chart_with_labels.py rename to tests/examples_arguments_syntax/bar_chart_with_labels.py diff --git a/altair/examples/bar_chart_with_mean_line.py b/tests/examples_arguments_syntax/bar_chart_with_mean_line.py similarity index 100% rename from altair/examples/bar_chart_with_mean_line.py rename to tests/examples_arguments_syntax/bar_chart_with_mean_line.py diff --git a/altair/examples/bar_chart_with_negatives.py b/tests/examples_arguments_syntax/bar_chart_with_negatives.py similarity index 100% rename from altair/examples/bar_chart_with_negatives.py rename to tests/examples_arguments_syntax/bar_chart_with_negatives.py diff --git a/altair/examples/bar_rounded.py b/tests/examples_arguments_syntax/bar_rounded.py similarity index 100% rename from altair/examples/bar_rounded.py rename to tests/examples_arguments_syntax/bar_rounded.py diff --git a/altair/examples/bar_with_rolling_mean.py b/tests/examples_arguments_syntax/bar_with_rolling_mean.py similarity index 100% rename from altair/examples/bar_with_rolling_mean.py rename to tests/examples_arguments_syntax/bar_with_rolling_mean.py diff --git a/altair/examples/beckers_barley_trellis_plot.py b/tests/examples_arguments_syntax/beckers_barley_trellis_plot.py similarity index 100% rename from altair/examples/beckers_barley_trellis_plot.py rename to tests/examples_arguments_syntax/beckers_barley_trellis_plot.py diff --git a/altair/examples/beckers_barley_wrapped_facet.py b/tests/examples_arguments_syntax/beckers_barley_wrapped_facet.py similarity index 100% rename from altair/examples/beckers_barley_wrapped_facet.py rename to tests/examples_arguments_syntax/beckers_barley_wrapped_facet.py diff --git a/altair/examples/boxplot.py b/tests/examples_arguments_syntax/boxplot.py similarity index 100% rename from altair/examples/boxplot.py rename to tests/examples_arguments_syntax/boxplot.py diff --git a/altair/examples/bubble_plot.py b/tests/examples_arguments_syntax/bubble_plot.py similarity index 100% rename from altair/examples/bubble_plot.py rename to tests/examples_arguments_syntax/bubble_plot.py diff --git a/altair/examples/bump_chart.py b/tests/examples_arguments_syntax/bump_chart.py similarity index 100% rename from altair/examples/bump_chart.py rename to tests/examples_arguments_syntax/bump_chart.py diff --git a/altair/examples/candlestick_chart.py b/tests/examples_arguments_syntax/candlestick_chart.py similarity index 100% rename from altair/examples/candlestick_chart.py rename to tests/examples_arguments_syntax/candlestick_chart.py diff --git a/altair/examples/choropleth.py b/tests/examples_arguments_syntax/choropleth.py similarity index 100% rename from altair/examples/choropleth.py rename to tests/examples_arguments_syntax/choropleth.py diff --git a/altair/examples/choropleth_repeat.py b/tests/examples_arguments_syntax/choropleth_repeat.py similarity index 100% rename from altair/examples/choropleth_repeat.py rename to tests/examples_arguments_syntax/choropleth_repeat.py diff --git a/altair/examples/co2_concentration.py b/tests/examples_arguments_syntax/co2_concentration.py similarity index 100% rename from altair/examples/co2_concentration.py rename to tests/examples_arguments_syntax/co2_concentration.py diff --git a/altair/examples/comet_chart.py b/tests/examples_arguments_syntax/comet_chart.py similarity index 100% rename from altair/examples/comet_chart.py rename to tests/examples_arguments_syntax/comet_chart.py diff --git a/altair/examples/connected_scatterplot.py b/tests/examples_arguments_syntax/connected_scatterplot.py similarity index 100% rename from altair/examples/connected_scatterplot.py rename to tests/examples_arguments_syntax/connected_scatterplot.py diff --git a/altair/examples/cumulative_count_chart.py b/tests/examples_arguments_syntax/cumulative_count_chart.py similarity index 100% rename from altair/examples/cumulative_count_chart.py rename to tests/examples_arguments_syntax/cumulative_count_chart.py diff --git a/altair/examples/dendrogram.py b/tests/examples_arguments_syntax/dendrogram.py similarity index 100% rename from altair/examples/dendrogram.py rename to tests/examples_arguments_syntax/dendrogram.py diff --git a/altair/examples/density_facet.py b/tests/examples_arguments_syntax/density_facet.py similarity index 100% rename from altair/examples/density_facet.py rename to tests/examples_arguments_syntax/density_facet.py diff --git a/altair/examples/density_stack.py b/tests/examples_arguments_syntax/density_stack.py similarity index 100% rename from altair/examples/density_stack.py rename to tests/examples_arguments_syntax/density_stack.py diff --git a/altair/examples/diverging_stacked_bar_chart.py b/tests/examples_arguments_syntax/diverging_stacked_bar_chart.py similarity index 100% rename from altair/examples/diverging_stacked_bar_chart.py rename to tests/examples_arguments_syntax/diverging_stacked_bar_chart.py diff --git a/altair/examples/donut_chart.py b/tests/examples_arguments_syntax/donut_chart.py similarity index 100% rename from altair/examples/donut_chart.py rename to tests/examples_arguments_syntax/donut_chart.py diff --git a/altair/examples/dot_dash_plot.py b/tests/examples_arguments_syntax/dot_dash_plot.py similarity index 100% rename from altair/examples/dot_dash_plot.py rename to tests/examples_arguments_syntax/dot_dash_plot.py diff --git a/altair/examples/empirical_cumulative_distribution_function.py b/tests/examples_arguments_syntax/empirical_cumulative_distribution_function.py similarity index 100% rename from altair/examples/empirical_cumulative_distribution_function.py rename to tests/examples_arguments_syntax/empirical_cumulative_distribution_function.py diff --git a/altair/examples/errorbars_with_ci.py b/tests/examples_arguments_syntax/errorbars_with_ci.py similarity index 100% rename from altair/examples/errorbars_with_ci.py rename to tests/examples_arguments_syntax/errorbars_with_ci.py diff --git a/altair/examples/errorbars_with_std.py b/tests/examples_arguments_syntax/errorbars_with_std.py similarity index 100% rename from altair/examples/errorbars_with_std.py rename to tests/examples_arguments_syntax/errorbars_with_std.py diff --git a/altair/examples/falkensee.py b/tests/examples_arguments_syntax/falkensee.py similarity index 100% rename from altair/examples/falkensee.py rename to tests/examples_arguments_syntax/falkensee.py diff --git a/altair/examples/filled_step_chart.py b/tests/examples_arguments_syntax/filled_step_chart.py similarity index 100% rename from altair/examples/filled_step_chart.py rename to tests/examples_arguments_syntax/filled_step_chart.py diff --git a/altair/examples/gantt_chart.py b/tests/examples_arguments_syntax/gantt_chart.py similarity index 100% rename from altair/examples/gantt_chart.py rename to tests/examples_arguments_syntax/gantt_chart.py diff --git a/altair/examples/gapminder_bubble_plot.py b/tests/examples_arguments_syntax/gapminder_bubble_plot.py similarity index 100% rename from altair/examples/gapminder_bubble_plot.py rename to tests/examples_arguments_syntax/gapminder_bubble_plot.py diff --git a/altair/examples/groupby-map.py b/tests/examples_arguments_syntax/groupby-map.py similarity index 100% rename from altair/examples/groupby-map.py rename to tests/examples_arguments_syntax/groupby-map.py diff --git a/altair/examples/grouped_bar_chart.py b/tests/examples_arguments_syntax/grouped_bar_chart.py similarity index 100% rename from altair/examples/grouped_bar_chart.py rename to tests/examples_arguments_syntax/grouped_bar_chart.py diff --git a/altair/examples/grouped_bar_chart2.py b/tests/examples_arguments_syntax/grouped_bar_chart2.py similarity index 100% rename from altair/examples/grouped_bar_chart2.py rename to tests/examples_arguments_syntax/grouped_bar_chart2.py diff --git a/altair/examples/grouped_bar_chart_horizontal.py b/tests/examples_arguments_syntax/grouped_bar_chart_horizontal.py similarity index 100% rename from altair/examples/grouped_bar_chart_horizontal.py rename to tests/examples_arguments_syntax/grouped_bar_chart_horizontal.py diff --git a/altair/examples/grouped_bar_chart_with_error_bars.py b/tests/examples_arguments_syntax/grouped_bar_chart_with_error_bars.py similarity index 100% rename from altair/examples/grouped_bar_chart_with_error_bars.py rename to tests/examples_arguments_syntax/grouped_bar_chart_with_error_bars.py diff --git a/altair/examples/hexbins.py b/tests/examples_arguments_syntax/hexbins.py similarity index 100% rename from altair/examples/hexbins.py rename to tests/examples_arguments_syntax/hexbins.py diff --git a/altair/examples/histogram_heatmap.py b/tests/examples_arguments_syntax/histogram_heatmap.py similarity index 100% rename from altair/examples/histogram_heatmap.py rename to tests/examples_arguments_syntax/histogram_heatmap.py diff --git a/altair/examples/histogram_responsive.py b/tests/examples_arguments_syntax/histogram_responsive.py similarity index 100% rename from altair/examples/histogram_responsive.py rename to tests/examples_arguments_syntax/histogram_responsive.py diff --git a/altair/examples/histogram_scatterplot.py b/tests/examples_arguments_syntax/histogram_scatterplot.py similarity index 100% rename from altair/examples/histogram_scatterplot.py rename to tests/examples_arguments_syntax/histogram_scatterplot.py diff --git a/altair/examples/histogram_with_a_global_mean_overlay.py b/tests/examples_arguments_syntax/histogram_with_a_global_mean_overlay.py similarity index 100% rename from altair/examples/histogram_with_a_global_mean_overlay.py rename to tests/examples_arguments_syntax/histogram_with_a_global_mean_overlay.py diff --git a/altair/examples/horizon_graph.py b/tests/examples_arguments_syntax/horizon_graph.py similarity index 100% rename from altair/examples/horizon_graph.py rename to tests/examples_arguments_syntax/horizon_graph.py diff --git a/altair/examples/horizontal_stacked_bar_chart.py b/tests/examples_arguments_syntax/horizontal_stacked_bar_chart.py similarity index 100% rename from altair/examples/horizontal_stacked_bar_chart.py rename to tests/examples_arguments_syntax/horizontal_stacked_bar_chart.py diff --git a/altair/examples/image_tooltip.py b/tests/examples_arguments_syntax/image_tooltip.py similarity index 100% rename from altair/examples/image_tooltip.py rename to tests/examples_arguments_syntax/image_tooltip.py diff --git a/altair/examples/interactive_brush.py b/tests/examples_arguments_syntax/interactive_brush.py similarity index 100% rename from altair/examples/interactive_brush.py rename to tests/examples_arguments_syntax/interactive_brush.py diff --git a/altair/examples/interactive_cross_highlight.py b/tests/examples_arguments_syntax/interactive_cross_highlight.py similarity index 100% rename from altair/examples/interactive_cross_highlight.py rename to tests/examples_arguments_syntax/interactive_cross_highlight.py diff --git a/altair/examples/interactive_layered_crossfilter.py b/tests/examples_arguments_syntax/interactive_layered_crossfilter.py similarity index 100% rename from altair/examples/interactive_layered_crossfilter.py rename to tests/examples_arguments_syntax/interactive_layered_crossfilter.py diff --git a/altair/examples/interactive_legend.py b/tests/examples_arguments_syntax/interactive_legend.py similarity index 100% rename from altair/examples/interactive_legend.py rename to tests/examples_arguments_syntax/interactive_legend.py diff --git a/altair/examples/interactive_scatter_plot.py b/tests/examples_arguments_syntax/interactive_scatter_plot.py similarity index 100% rename from altair/examples/interactive_scatter_plot.py rename to tests/examples_arguments_syntax/interactive_scatter_plot.py diff --git a/altair/examples/interval_selection.py b/tests/examples_arguments_syntax/interval_selection.py similarity index 100% rename from altair/examples/interval_selection.py rename to tests/examples_arguments_syntax/interval_selection.py diff --git a/altair/examples/iowa_electricity.py b/tests/examples_arguments_syntax/iowa_electricity.py similarity index 100% rename from altair/examples/iowa_electricity.py rename to tests/examples_arguments_syntax/iowa_electricity.py diff --git a/altair/examples/isotype.py b/tests/examples_arguments_syntax/isotype.py similarity index 100% rename from altair/examples/isotype.py rename to tests/examples_arguments_syntax/isotype.py diff --git a/altair/examples/isotype_emoji.py b/tests/examples_arguments_syntax/isotype_emoji.py similarity index 100% rename from altair/examples/isotype_emoji.py rename to tests/examples_arguments_syntax/isotype_emoji.py diff --git a/altair/examples/isotype_grid.py b/tests/examples_arguments_syntax/isotype_grid.py similarity index 100% rename from altair/examples/isotype_grid.py rename to tests/examples_arguments_syntax/isotype_grid.py diff --git a/altair/examples/lasagna_plot.py b/tests/examples_arguments_syntax/lasagna_plot.py similarity index 100% rename from altair/examples/lasagna_plot.py rename to tests/examples_arguments_syntax/lasagna_plot.py diff --git a/altair/examples/layer_line_color_rule.py b/tests/examples_arguments_syntax/layer_line_color_rule.py similarity index 100% rename from altair/examples/layer_line_color_rule.py rename to tests/examples_arguments_syntax/layer_line_color_rule.py diff --git a/altair/examples/layered_area_chart.py b/tests/examples_arguments_syntax/layered_area_chart.py similarity index 100% rename from altair/examples/layered_area_chart.py rename to tests/examples_arguments_syntax/layered_area_chart.py diff --git a/altair/examples/layered_bar_chart.py b/tests/examples_arguments_syntax/layered_bar_chart.py similarity index 100% rename from altair/examples/layered_bar_chart.py rename to tests/examples_arguments_syntax/layered_bar_chart.py diff --git a/altair/examples/layered_chart_bar_mark.py b/tests/examples_arguments_syntax/layered_chart_bar_mark.py similarity index 100% rename from altair/examples/layered_chart_bar_mark.py rename to tests/examples_arguments_syntax/layered_chart_bar_mark.py diff --git a/altair/examples/layered_chart_with_dual_axis.py b/tests/examples_arguments_syntax/layered_chart_with_dual_axis.py similarity index 100% rename from altair/examples/layered_chart_with_dual_axis.py rename to tests/examples_arguments_syntax/layered_chart_with_dual_axis.py diff --git a/altair/examples/layered_heatmap_text.py b/tests/examples_arguments_syntax/layered_heatmap_text.py similarity index 100% rename from altair/examples/layered_heatmap_text.py rename to tests/examples_arguments_syntax/layered_heatmap_text.py diff --git a/altair/examples/layered_histogram.py b/tests/examples_arguments_syntax/layered_histogram.py similarity index 100% rename from altair/examples/layered_histogram.py rename to tests/examples_arguments_syntax/layered_histogram.py diff --git a/altair/examples/line_chart_with_color_datum.py b/tests/examples_arguments_syntax/line_chart_with_color_datum.py similarity index 100% rename from altair/examples/line_chart_with_color_datum.py rename to tests/examples_arguments_syntax/line_chart_with_color_datum.py diff --git a/altair/examples/line_chart_with_cumsum.py b/tests/examples_arguments_syntax/line_chart_with_cumsum.py similarity index 100% rename from altair/examples/line_chart_with_cumsum.py rename to tests/examples_arguments_syntax/line_chart_with_cumsum.py diff --git a/altair/examples/line_chart_with_custom_legend.py b/tests/examples_arguments_syntax/line_chart_with_custom_legend.py similarity index 100% rename from altair/examples/line_chart_with_custom_legend.py rename to tests/examples_arguments_syntax/line_chart_with_custom_legend.py diff --git a/altair/examples/line_chart_with_datum.py b/tests/examples_arguments_syntax/line_chart_with_datum.py similarity index 100% rename from altair/examples/line_chart_with_datum.py rename to tests/examples_arguments_syntax/line_chart_with_datum.py diff --git a/altair/examples/line_chart_with_generator.py b/tests/examples_arguments_syntax/line_chart_with_generator.py similarity index 100% rename from altair/examples/line_chart_with_generator.py rename to tests/examples_arguments_syntax/line_chart_with_generator.py diff --git a/altair/examples/line_chart_with_interpolation.py b/tests/examples_arguments_syntax/line_chart_with_interpolation.py similarity index 100% rename from altair/examples/line_chart_with_interpolation.py rename to tests/examples_arguments_syntax/line_chart_with_interpolation.py diff --git a/altair/examples/line_chart_with_points.py b/tests/examples_arguments_syntax/line_chart_with_points.py similarity index 100% rename from altair/examples/line_chart_with_points.py rename to tests/examples_arguments_syntax/line_chart_with_points.py diff --git a/altair/examples/line_chart_with_points_stroked.py b/tests/examples_arguments_syntax/line_chart_with_points_stroked.py similarity index 100% rename from altair/examples/line_chart_with_points_stroked.py rename to tests/examples_arguments_syntax/line_chart_with_points_stroked.py diff --git a/altair/examples/line_percent.py b/tests/examples_arguments_syntax/line_percent.py similarity index 100% rename from altair/examples/line_percent.py rename to tests/examples_arguments_syntax/line_percent.py diff --git a/altair/examples/line_with_ci.py b/tests/examples_arguments_syntax/line_with_ci.py similarity index 100% rename from altair/examples/line_with_ci.py rename to tests/examples_arguments_syntax/line_with_ci.py diff --git a/altair/examples/line_with_last_value_labeled b/tests/examples_arguments_syntax/line_with_last_value_labeled.py similarity index 56% rename from altair/examples/line_with_last_value_labeled rename to tests/examples_arguments_syntax/line_with_last_value_labeled.py index 8793cab29..bc9fda7ae 100644 --- a/altair/examples/line_with_last_value_labeled +++ b/tests/examples_arguments_syntax/line_with_last_value_labeled.py @@ -11,27 +11,25 @@ source = data.stocks() # Create a common chart object -chart = alt.Chart(source).transform_filter( - alt.datum.symbol != "IBM" # A reducation of the dataset to clarify our example. Not required. -).encode( - color=alt.Color("symbol", legend=None) +# Use `transform_filter` to reduce the dataset to clarify our example. Not required. +chart = ( + alt.Chart(source) + .transform_filter(alt.datum.symbol != "IBM") + .encode(color=alt.Color("symbol", legend=None)) ) # Draw the line -line = chart.mark_line().encode( - x="date:T", - y="price:Q" -) +line = chart.mark_line().encode(x="date:T", y="price:Q") # Use the `argmax` aggregate to limit the dataset to the final value label = chart.encode( - x=alt.X('max(date):T'), - y=alt.Y('price:Q', aggregate=alt.ArgmaxDef(argmax='date')), - text='symbol' + x=alt.X("max(date):T"), + y=alt.Y("price:Q", aggregate=alt.ArgmaxDef(argmax="date")), + text="symbol", ) # Create a text label -text = label.mark_text(align='left', dx=4) +text = label.mark_text(align="left", dx=4) # Create a circle annotation circle = label.mark_circle() diff --git a/altair/examples/line_with_log_scale.py b/tests/examples_arguments_syntax/line_with_log_scale.py similarity index 100% rename from altair/examples/line_with_log_scale.py rename to tests/examples_arguments_syntax/line_with_log_scale.py diff --git a/altair/examples/london_tube.py b/tests/examples_arguments_syntax/london_tube.py similarity index 100% rename from altair/examples/london_tube.py rename to tests/examples_arguments_syntax/london_tube.py diff --git a/altair/examples/mosaic_with_labels.py b/tests/examples_arguments_syntax/mosaic_with_labels.py similarity index 100% rename from altair/examples/mosaic_with_labels.py rename to tests/examples_arguments_syntax/mosaic_with_labels.py diff --git a/altair/examples/multi_series_line.py b/tests/examples_arguments_syntax/multi_series_line.py similarity index 100% rename from altair/examples/multi_series_line.py rename to tests/examples_arguments_syntax/multi_series_line.py diff --git a/altair/examples/multifeature_scatter_plot.py b/tests/examples_arguments_syntax/multifeature_scatter_plot.py similarity index 100% rename from altair/examples/multifeature_scatter_plot.py rename to tests/examples_arguments_syntax/multifeature_scatter_plot.py diff --git a/altair/examples/multiline_highlight.py b/tests/examples_arguments_syntax/multiline_highlight.py similarity index 100% rename from altair/examples/multiline_highlight.py rename to tests/examples_arguments_syntax/multiline_highlight.py diff --git a/altair/examples/multiline_tooltip.py b/tests/examples_arguments_syntax/multiline_tooltip.py similarity index 100% rename from altair/examples/multiline_tooltip.py rename to tests/examples_arguments_syntax/multiline_tooltip.py diff --git a/altair/examples/multiple_interactions.py b/tests/examples_arguments_syntax/multiple_interactions.py similarity index 100% rename from altair/examples/multiple_interactions.py rename to tests/examples_arguments_syntax/multiple_interactions.py diff --git a/altair/examples/natural_disasters.py b/tests/examples_arguments_syntax/natural_disasters.py similarity index 100% rename from altair/examples/natural_disasters.py rename to tests/examples_arguments_syntax/natural_disasters.py diff --git a/altair/examples/normalized_stacked_area_chart.py b/tests/examples_arguments_syntax/normalized_stacked_area_chart.py similarity index 100% rename from altair/examples/normalized_stacked_area_chart.py rename to tests/examples_arguments_syntax/normalized_stacked_area_chart.py diff --git a/altair/examples/normalized_stacked_bar_chart.py b/tests/examples_arguments_syntax/normalized_stacked_bar_chart.py similarity index 100% rename from altair/examples/normalized_stacked_bar_chart.py rename to tests/examples_arguments_syntax/normalized_stacked_bar_chart.py diff --git a/altair/examples/normed_parallel_coordinates.py b/tests/examples_arguments_syntax/normed_parallel_coordinates.py similarity index 100% rename from altair/examples/normed_parallel_coordinates.py rename to tests/examples_arguments_syntax/normed_parallel_coordinates.py diff --git a/altair/examples/one_dot_per_zipcode.py b/tests/examples_arguments_syntax/one_dot_per_zipcode.py similarity index 100% rename from altair/examples/one_dot_per_zipcode.py rename to tests/examples_arguments_syntax/one_dot_per_zipcode.py diff --git a/altair/examples/pacman_chart.py b/tests/examples_arguments_syntax/pacman_chart.py similarity index 100% rename from altair/examples/pacman_chart.py rename to tests/examples_arguments_syntax/pacman_chart.py diff --git a/altair/examples/parallel_coordinates.py b/tests/examples_arguments_syntax/parallel_coordinates.py similarity index 100% rename from altair/examples/parallel_coordinates.py rename to tests/examples_arguments_syntax/parallel_coordinates.py diff --git a/altair/examples/percentage_of_total.py b/tests/examples_arguments_syntax/percentage_of_total.py similarity index 100% rename from altair/examples/percentage_of_total.py rename to tests/examples_arguments_syntax/percentage_of_total.py diff --git a/altair/examples/pie_chart.py b/tests/examples_arguments_syntax/pie_chart.py similarity index 100% rename from altair/examples/pie_chart.py rename to tests/examples_arguments_syntax/pie_chart.py diff --git a/altair/examples/pie_chart_with_labels.py b/tests/examples_arguments_syntax/pie_chart_with_labels.py similarity index 100% rename from altair/examples/pie_chart_with_labels.py rename to tests/examples_arguments_syntax/pie_chart_with_labels.py diff --git a/altair/examples/point_map.py b/tests/examples_arguments_syntax/point_map.py similarity index 100% rename from altair/examples/point_map.py rename to tests/examples_arguments_syntax/point_map.py diff --git a/altair/examples/poly_fit_regression.py b/tests/examples_arguments_syntax/poly_fit_regression.py similarity index 100% rename from altair/examples/poly_fit_regression.py rename to tests/examples_arguments_syntax/poly_fit_regression.py diff --git a/altair/examples/pyramid.py b/tests/examples_arguments_syntax/pyramid.py similarity index 100% rename from altair/examples/pyramid.py rename to tests/examples_arguments_syntax/pyramid.py diff --git a/altair/examples/radial_chart.py b/tests/examples_arguments_syntax/radial_chart.py similarity index 100% rename from altair/examples/radial_chart.py rename to tests/examples_arguments_syntax/radial_chart.py diff --git a/altair/examples/ranged_dot_plot.py b/tests/examples_arguments_syntax/ranged_dot_plot.py similarity index 100% rename from altair/examples/ranged_dot_plot.py rename to tests/examples_arguments_syntax/ranged_dot_plot.py diff --git a/altair/examples/ridgeline_plot.py b/tests/examples_arguments_syntax/ridgeline_plot.py similarity index 100% rename from altair/examples/ridgeline_plot.py rename to tests/examples_arguments_syntax/ridgeline_plot.py diff --git a/altair/examples/scatter_href.py b/tests/examples_arguments_syntax/scatter_href.py similarity index 100% rename from altair/examples/scatter_href.py rename to tests/examples_arguments_syntax/scatter_href.py diff --git a/altair/examples/scatter_linked_brush.py b/tests/examples_arguments_syntax/scatter_linked_brush.py similarity index 100% rename from altair/examples/scatter_linked_brush.py rename to tests/examples_arguments_syntax/scatter_linked_brush.py diff --git a/altair/examples/scatter_linked_table.py b/tests/examples_arguments_syntax/scatter_linked_table.py similarity index 100% rename from altair/examples/scatter_linked_table.py rename to tests/examples_arguments_syntax/scatter_linked_table.py diff --git a/altair/examples/scatter_marginal_hist.py b/tests/examples_arguments_syntax/scatter_marginal_hist.py similarity index 100% rename from altair/examples/scatter_marginal_hist.py rename to tests/examples_arguments_syntax/scatter_marginal_hist.py diff --git a/altair/examples/scatter_matrix.py b/tests/examples_arguments_syntax/scatter_matrix.py similarity index 100% rename from altair/examples/scatter_matrix.py rename to tests/examples_arguments_syntax/scatter_matrix.py diff --git a/altair/examples/scatter_qq.py b/tests/examples_arguments_syntax/scatter_qq.py similarity index 100% rename from altair/examples/scatter_qq.py rename to tests/examples_arguments_syntax/scatter_qq.py diff --git a/altair/examples/scatter_tooltips.py b/tests/examples_arguments_syntax/scatter_tooltips.py similarity index 100% rename from altair/examples/scatter_tooltips.py rename to tests/examples_arguments_syntax/scatter_tooltips.py diff --git a/altair/examples/scatter_with_histogram.py b/tests/examples_arguments_syntax/scatter_with_histogram.py similarity index 100% rename from altair/examples/scatter_with_histogram.py rename to tests/examples_arguments_syntax/scatter_with_histogram.py diff --git a/altair/examples/scatter_with_labels.py b/tests/examples_arguments_syntax/scatter_with_labels.py similarity index 100% rename from altair/examples/scatter_with_labels.py rename to tests/examples_arguments_syntax/scatter_with_labels.py diff --git a/altair/examples/scatter_with_layered_histogram.py b/tests/examples_arguments_syntax/scatter_with_layered_histogram.py similarity index 100% rename from altair/examples/scatter_with_layered_histogram.py rename to tests/examples_arguments_syntax/scatter_with_layered_histogram.py diff --git a/altair/examples/scatter_with_loess.py b/tests/examples_arguments_syntax/scatter_with_loess.py similarity index 100% rename from altair/examples/scatter_with_loess.py rename to tests/examples_arguments_syntax/scatter_with_loess.py diff --git a/altair/examples/scatter_with_minimap.py b/tests/examples_arguments_syntax/scatter_with_minimap.py similarity index 100% rename from altair/examples/scatter_with_minimap.py rename to tests/examples_arguments_syntax/scatter_with_minimap.py diff --git a/altair/examples/scatter_with_rolling_mean.py b/tests/examples_arguments_syntax/scatter_with_rolling_mean.py similarity index 100% rename from altair/examples/scatter_with_rolling_mean.py rename to tests/examples_arguments_syntax/scatter_with_rolling_mean.py diff --git a/altair/examples/seattle_weather_interactive.py b/tests/examples_arguments_syntax/seattle_weather_interactive.py similarity index 100% rename from altair/examples/seattle_weather_interactive.py rename to tests/examples_arguments_syntax/seattle_weather_interactive.py diff --git a/altair/examples/select_detail.py b/tests/examples_arguments_syntax/select_detail.py similarity index 100% rename from altair/examples/select_detail.py rename to tests/examples_arguments_syntax/select_detail.py diff --git a/altair/examples/select_mark_area.py b/tests/examples_arguments_syntax/select_mark_area.py similarity index 100% rename from altair/examples/select_mark_area.py rename to tests/examples_arguments_syntax/select_mark_area.py diff --git a/altair/examples/selection_histogram.py b/tests/examples_arguments_syntax/selection_histogram.py similarity index 100% rename from altair/examples/selection_histogram.py rename to tests/examples_arguments_syntax/selection_histogram.py diff --git a/altair/examples/selection_layer_bar_month.py b/tests/examples_arguments_syntax/selection_layer_bar_month.py similarity index 100% rename from altair/examples/selection_layer_bar_month.py rename to tests/examples_arguments_syntax/selection_layer_bar_month.py diff --git a/altair/examples/simple_bar_chart.py b/tests/examples_arguments_syntax/simple_bar_chart.py similarity index 100% rename from altair/examples/simple_bar_chart.py rename to tests/examples_arguments_syntax/simple_bar_chart.py diff --git a/altair/examples/simple_heatmap.py b/tests/examples_arguments_syntax/simple_heatmap.py similarity index 100% rename from altair/examples/simple_heatmap.py rename to tests/examples_arguments_syntax/simple_heatmap.py diff --git a/altair/examples/simple_histogram.py b/tests/examples_arguments_syntax/simple_histogram.py similarity index 100% rename from altair/examples/simple_histogram.py rename to tests/examples_arguments_syntax/simple_histogram.py diff --git a/altair/examples/simple_line_chart.py b/tests/examples_arguments_syntax/simple_line_chart.py similarity index 100% rename from altair/examples/simple_line_chart.py rename to tests/examples_arguments_syntax/simple_line_chart.py diff --git a/altair/examples/simple_scatter_with_errorbars.py b/tests/examples_arguments_syntax/simple_scatter_with_errorbars.py similarity index 100% rename from altair/examples/simple_scatter_with_errorbars.py rename to tests/examples_arguments_syntax/simple_scatter_with_errorbars.py diff --git a/altair/examples/simple_stacked_area_chart.py b/tests/examples_arguments_syntax/simple_stacked_area_chart.py similarity index 100% rename from altair/examples/simple_stacked_area_chart.py rename to tests/examples_arguments_syntax/simple_stacked_area_chart.py diff --git a/altair/examples/slider_cutoff.py b/tests/examples_arguments_syntax/slider_cutoff.py similarity index 100% rename from altair/examples/slider_cutoff.py rename to tests/examples_arguments_syntax/slider_cutoff.py diff --git a/altair/examples/slope_graph.py b/tests/examples_arguments_syntax/slope_graph.py similarity index 100% rename from altair/examples/slope_graph.py rename to tests/examples_arguments_syntax/slope_graph.py diff --git a/altair/examples/sorted_error_bars_with_ci.py b/tests/examples_arguments_syntax/sorted_error_bars_with_ci.py similarity index 100% rename from altair/examples/sorted_error_bars_with_ci.py rename to tests/examples_arguments_syntax/sorted_error_bars_with_ci.py diff --git a/altair/examples/stacked_bar_chart.py b/tests/examples_arguments_syntax/stacked_bar_chart.py similarity index 100% rename from altair/examples/stacked_bar_chart.py rename to tests/examples_arguments_syntax/stacked_bar_chart.py diff --git a/altair/examples/stacked_bar_chart_sorted_segments.py b/tests/examples_arguments_syntax/stacked_bar_chart_sorted_segments.py similarity index 100% rename from altair/examples/stacked_bar_chart_sorted_segments.py rename to tests/examples_arguments_syntax/stacked_bar_chart_sorted_segments.py diff --git a/altair/examples/stacked_bar_chart_with_text.py b/tests/examples_arguments_syntax/stacked_bar_chart_with_text.py similarity index 100% rename from altair/examples/stacked_bar_chart_with_text.py rename to tests/examples_arguments_syntax/stacked_bar_chart_with_text.py diff --git a/altair/examples/stem_and_leaf.py b/tests/examples_arguments_syntax/stem_and_leaf.py similarity index 100% rename from altair/examples/stem_and_leaf.py rename to tests/examples_arguments_syntax/stem_and_leaf.py diff --git a/altair/examples/step_chart.py b/tests/examples_arguments_syntax/step_chart.py similarity index 100% rename from altair/examples/step_chart.py rename to tests/examples_arguments_syntax/step_chart.py diff --git a/altair/examples/streamgraph.py b/tests/examples_arguments_syntax/streamgraph.py similarity index 100% rename from altair/examples/streamgraph.py rename to tests/examples_arguments_syntax/streamgraph.py diff --git a/altair/examples/strip_plot.py b/tests/examples_arguments_syntax/strip_plot.py similarity index 100% rename from altair/examples/strip_plot.py rename to tests/examples_arguments_syntax/strip_plot.py diff --git a/altair/examples/strip_plot_jitter.py b/tests/examples_arguments_syntax/strip_plot_jitter.py similarity index 100% rename from altair/examples/strip_plot_jitter.py rename to tests/examples_arguments_syntax/strip_plot_jitter.py diff --git a/altair/examples/table_bubble_plot_github.py b/tests/examples_arguments_syntax/table_bubble_plot_github.py similarity index 100% rename from altair/examples/table_bubble_plot_github.py rename to tests/examples_arguments_syntax/table_bubble_plot_github.py diff --git a/altair/sphinxext/__init__.py b/tests/examples_arguments_syntax/tests/__init__.py similarity index 100% rename from altair/sphinxext/__init__.py rename to tests/examples_arguments_syntax/tests/__init__.py diff --git a/altair/examples/tests/test_examples.py b/tests/examples_arguments_syntax/tests/test_examples.py similarity index 85% rename from altair/examples/tests/test_examples.py rename to tests/examples_arguments_syntax/tests/test_examples.py index 186526dd6..8ffe2fd1d 100644 --- a/altair/examples/tests/test_examples.py +++ b/tests/examples_arguments_syntax/tests/test_examples.py @@ -4,7 +4,7 @@ import pytest from altair.utils.execeval import eval_block -from altair import examples +from tests import examples_arguments_syntax try: import altair_saver # noqa: F401 @@ -18,7 +18,9 @@ def iter_example_filenames(): - for importer, modname, ispkg in pkgutil.iter_modules(examples.__path__): + for importer, modname, ispkg in pkgutil.iter_modules( + examples_arguments_syntax.__path__ + ): if ispkg or modname.startswith("_"): continue yield modname + ".py" @@ -26,7 +28,7 @@ def iter_example_filenames(): @pytest.mark.parametrize("filename", iter_example_filenames()) def test_examples(filename: str): - source = pkgutil.get_data(examples.__name__, filename) + source = pkgutil.get_data(examples_arguments_syntax.__name__, filename) chart = eval_block(source) if chart is None: @@ -50,7 +52,7 @@ def test_render_examples_to_png(engine, filename): if "png" not in altair_saver.available_formats("vega-lite"): pytest.skip("altair_saver not configured to save to png") - source = pkgutil.get_data(examples.__name__, filename) + source = pkgutil.get_data(examples_arguments_syntax.__name__, filename) chart = eval_block(source) out = io.BytesIO() chart.save(out, format="png", engine=engine) diff --git a/altair/examples/top_k_items.py b/tests/examples_arguments_syntax/top_k_items.py similarity index 100% rename from altair/examples/top_k_items.py rename to tests/examples_arguments_syntax/top_k_items.py diff --git a/altair/examples/top_k_letters.py b/tests/examples_arguments_syntax/top_k_letters.py similarity index 100% rename from altair/examples/top_k_letters.py rename to tests/examples_arguments_syntax/top_k_letters.py diff --git a/altair/examples/top_k_with_others.py b/tests/examples_arguments_syntax/top_k_with_others.py similarity index 100% rename from altair/examples/top_k_with_others.py rename to tests/examples_arguments_syntax/top_k_with_others.py diff --git a/altair/examples/trail_marker.py b/tests/examples_arguments_syntax/trail_marker.py similarity index 100% rename from altair/examples/trail_marker.py rename to tests/examples_arguments_syntax/trail_marker.py diff --git a/altair/examples/trellis_area.py b/tests/examples_arguments_syntax/trellis_area.py similarity index 100% rename from altair/examples/trellis_area.py rename to tests/examples_arguments_syntax/trellis_area.py diff --git a/altair/examples/trellis_area_sort_array.py b/tests/examples_arguments_syntax/trellis_area_sort_array.py similarity index 100% rename from altair/examples/trellis_area_sort_array.py rename to tests/examples_arguments_syntax/trellis_area_sort_array.py diff --git a/altair/examples/trellis_histogram.py b/tests/examples_arguments_syntax/trellis_histogram.py similarity index 100% rename from altair/examples/trellis_histogram.py rename to tests/examples_arguments_syntax/trellis_histogram.py diff --git a/altair/examples/trellis_scatter_plot.py b/tests/examples_arguments_syntax/trellis_scatter_plot.py similarity index 100% rename from altair/examples/trellis_scatter_plot.py rename to tests/examples_arguments_syntax/trellis_scatter_plot.py diff --git a/altair/examples/trellis_stacked_bar_chart.py b/tests/examples_arguments_syntax/trellis_stacked_bar_chart.py similarity index 100% rename from altair/examples/trellis_stacked_bar_chart.py rename to tests/examples_arguments_syntax/trellis_stacked_bar_chart.py diff --git a/altair/examples/us_employment.py b/tests/examples_arguments_syntax/us_employment.py similarity index 100% rename from altair/examples/us_employment.py rename to tests/examples_arguments_syntax/us_employment.py diff --git a/altair/examples/us_incomebrackets_by_state_facet.py b/tests/examples_arguments_syntax/us_incomebrackets_by_state_facet.py similarity index 100% rename from altair/examples/us_incomebrackets_by_state_facet.py rename to tests/examples_arguments_syntax/us_incomebrackets_by_state_facet.py diff --git a/altair/examples/us_population_over_time.py b/tests/examples_arguments_syntax/us_population_over_time.py similarity index 100% rename from altair/examples/us_population_over_time.py rename to tests/examples_arguments_syntax/us_population_over_time.py diff --git a/altair/examples/us_population_over_time_facet.py b/tests/examples_arguments_syntax/us_population_over_time_facet.py similarity index 100% rename from altair/examples/us_population_over_time_facet.py rename to tests/examples_arguments_syntax/us_population_over_time_facet.py diff --git a/altair/examples/us_population_pyramid_over_time.py b/tests/examples_arguments_syntax/us_population_pyramid_over_time.py similarity index 100% rename from altair/examples/us_population_pyramid_over_time.py rename to tests/examples_arguments_syntax/us_population_pyramid_over_time.py diff --git a/altair/examples/us_state_capitals.py b/tests/examples_arguments_syntax/us_state_capitals.py similarity index 100% rename from altair/examples/us_state_capitals.py rename to tests/examples_arguments_syntax/us_state_capitals.py diff --git a/altair/examples/violin_plot.py b/tests/examples_arguments_syntax/violin_plot.py similarity index 100% rename from altair/examples/violin_plot.py rename to tests/examples_arguments_syntax/violin_plot.py diff --git a/altair/examples/waterfall_chart.py b/tests/examples_arguments_syntax/waterfall_chart.py similarity index 100% rename from altair/examples/waterfall_chart.py rename to tests/examples_arguments_syntax/waterfall_chart.py diff --git a/altair/examples/wheat_wages.py b/tests/examples_arguments_syntax/wheat_wages.py similarity index 100% rename from altair/examples/wheat_wages.py rename to tests/examples_arguments_syntax/wheat_wages.py diff --git a/altair/examples/wilkinson-dot-plot.py b/tests/examples_arguments_syntax/wilkinson-dot-plot.py similarity index 100% rename from altair/examples/wilkinson-dot-plot.py rename to tests/examples_arguments_syntax/wilkinson-dot-plot.py diff --git a/altair/examples/wind_vector_map.py b/tests/examples_arguments_syntax/wind_vector_map.py similarity index 100% rename from altair/examples/wind_vector_map.py rename to tests/examples_arguments_syntax/wind_vector_map.py diff --git a/altair/examples/window_rank.py b/tests/examples_arguments_syntax/window_rank.py similarity index 100% rename from altair/examples/window_rank.py rename to tests/examples_arguments_syntax/window_rank.py diff --git a/altair/examples/world_map.py b/tests/examples_arguments_syntax/world_map.py similarity index 100% rename from altair/examples/world_map.py rename to tests/examples_arguments_syntax/world_map.py diff --git a/altair/examples/world_projections.py b/tests/examples_arguments_syntax/world_projections.py similarity index 100% rename from altair/examples/world_projections.py rename to tests/examples_arguments_syntax/world_projections.py diff --git a/altair/tests/__init__.py b/tests/expr/__init__.py similarity index 100% rename from altair/tests/__init__.py rename to tests/expr/__init__.py diff --git a/altair/utils/tests/__init__.py b/tests/expr/tests/__init__.py similarity index 100% rename from altair/utils/tests/__init__.py rename to tests/expr/tests/__init__.py diff --git a/altair/expr/tests/test_expr.py b/tests/expr/tests/test_expr.py similarity index 98% rename from altair/expr/tests/test_expr.py rename to tests/expr/tests/test_expr.py index 19265406e..204ff2c1f 100644 --- a/altair/expr/tests/test_expr.py +++ b/tests/expr/tests/test_expr.py @@ -2,8 +2,8 @@ import pytest -from ... import expr -from .. import datum +from altair import expr +from altair import datum def test_unary_operations(): diff --git a/altair/vega/tests/__init__.py b/tests/tests/__init__.py similarity index 100% rename from altair/vega/tests/__init__.py rename to tests/tests/__init__.py diff --git a/altair/tests/test_magics.py b/tests/tests/test_magics.py similarity index 100% rename from altair/tests/test_magics.py rename to tests/tests/test_magics.py diff --git a/altair/vegalite/tests/__init__.py b/tests/utils/__init__.py similarity index 100% rename from altair/vegalite/tests/__init__.py rename to tests/utils/__init__.py diff --git a/altair/vegalite/v3/tests/__init__.py b/tests/utils/tests/__init__.py similarity index 100% rename from altair/vegalite/v3/tests/__init__.py rename to tests/utils/tests/__init__.py diff --git a/altair/utils/tests/test_core.py b/tests/utils/tests/test_core.py similarity index 98% rename from altair/utils/tests/test_core.py rename to tests/utils/tests/test_core.py index 752fd9184..c46d1744e 100644 --- a/altair/utils/tests/test_core.py +++ b/tests/utils/tests/test_core.py @@ -5,8 +5,8 @@ import pytest import altair as alt -from .. import parse_shorthand, update_nested, infer_encoding_types -from ..core import infer_dtype +from altair.utils.core import parse_shorthand, update_nested, infer_encoding_types +from altair.utils.core import infer_dtype FAKE_CHANNELS_MODULE = ''' """Fake channels module for utility tests.""" diff --git a/altair/utils/tests/test_data.py b/tests/utils/tests/test_data.py similarity index 96% rename from altair/utils/tests/test_data.py rename to tests/utils/tests/test_data.py index b4b4196ff..0d746e79d 100644 --- a/altair/utils/tests/test_data.py +++ b/tests/utils/tests/test_data.py @@ -4,7 +4,14 @@ import pandas as pd from toolz import pipe -from ..data import limit_rows, MaxRowsError, sample, to_values, to_json, to_csv +from altair.utils.data import ( + limit_rows, + MaxRowsError, + sample, + to_values, + to_json, + to_csv, +) def _create_dataframe(N): diff --git a/altair/utils/tests/test_deprecation.py b/tests/utils/tests/test_deprecation.py similarity index 100% rename from altair/utils/tests/test_deprecation.py rename to tests/utils/tests/test_deprecation.py diff --git a/altair/utils/tests/test_execeval.py b/tests/utils/tests/test_execeval.py similarity index 91% rename from altair/utils/tests/test_execeval.py rename to tests/utils/tests/test_execeval.py index 0cdd2cf4f..10ca93e35 100644 --- a/altair/utils/tests/test_execeval.py +++ b/tests/utils/tests/test_execeval.py @@ -1,4 +1,4 @@ -from ..execeval import eval_block +from altair.utils.execeval import eval_block HAS_RETURN = """ x = 4 diff --git a/altair/utils/tests/test_html.py b/tests/utils/tests/test_html.py similarity index 97% rename from altair/utils/tests/test_html.py rename to tests/utils/tests/test_html.py index 7e4445b0c..5f44704b5 100644 --- a/altair/utils/tests/test_html.py +++ b/tests/utils/tests/test_html.py @@ -1,6 +1,6 @@ import pytest -from ..html import spec_to_html +from altair.utils.html import spec_to_html @pytest.fixture diff --git a/altair/utils/tests/test_mimebundle.py b/tests/utils/tests/test_mimebundle.py similarity index 99% rename from altair/utils/tests/test_mimebundle.py rename to tests/utils/tests/test_mimebundle.py index 85790d37b..db6b579fe 100644 --- a/altair/utils/tests/test_mimebundle.py +++ b/tests/utils/tests/test_mimebundle.py @@ -1,7 +1,7 @@ import pytest import altair as alt -from ..mimebundle import spec_to_mimebundle +from altair.utils.mimebundle import spec_to_mimebundle try: import altair_saver # noqa: F401 diff --git a/altair/utils/tests/test_plugin_registry.py b/tests/utils/tests/test_plugin_registry.py similarity index 98% rename from altair/utils/tests/test_plugin_registry.py rename to tests/utils/tests/test_plugin_registry.py index 38f9cc053..b776a118a 100644 --- a/altair/utils/tests/test_plugin_registry.py +++ b/tests/utils/tests/test_plugin_registry.py @@ -1,4 +1,4 @@ -from ..plugin_registry import PluginRegistry +from altair.utils.plugin_registry import PluginRegistry from typing import Callable diff --git a/altair/utils/tests/test_schemapi.py b/tests/utils/tests/test_schemapi.py similarity index 99% rename from altair/utils/tests/test_schemapi.py rename to tests/utils/tests/test_schemapi.py index 09bbde747..00ce019d3 100644 --- a/altair/utils/tests/test_schemapi.py +++ b/tests/utils/tests/test_schemapi.py @@ -9,7 +9,7 @@ import numpy as np -from ..schemapi import ( +from altair.utils.schemapi import ( UndefinedType, SchemaBase, Undefined, diff --git a/altair/utils/tests/test_server.py b/tests/utils/tests/test_server.py similarity index 100% rename from altair/utils/tests/test_server.py rename to tests/utils/tests/test_server.py diff --git a/altair/utils/tests/test_utils.py b/tests/utils/tests/test_utils.py similarity index 99% rename from altair/utils/tests/test_utils.py rename to tests/utils/tests/test_utils.py index 54a127216..9f31ae4f8 100644 --- a/altair/utils/tests/test_utils.py +++ b/tests/utils/tests/test_utils.py @@ -5,7 +5,7 @@ import numpy as np import pandas as pd -from .. import infer_vegalite_type, sanitize_dataframe +from altair.utils import infer_vegalite_type, sanitize_dataframe def test_infer_vegalite_type(): diff --git a/altair/vegalite/v4/tests/__init__.py b/tests/vega/__init__.py similarity index 100% rename from altair/vegalite/v4/tests/__init__.py rename to tests/vega/__init__.py diff --git a/altair/vegalite/v5/tests/__init__.py b/tests/vega/tests/__init__.py similarity index 100% rename from altair/vegalite/v5/tests/__init__.py rename to tests/vega/tests/__init__.py diff --git a/altair/vega/tests/test_import.py b/tests/vega/tests/test_import.py similarity index 100% rename from altair/vega/tests/test_import.py rename to tests/vega/tests/test_import.py diff --git a/tests/vegalite/__init__.py b/tests/vegalite/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/vegalite/tests/__init__.py b/tests/vegalite/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/altair/vegalite/tests/test_common.py b/tests/vegalite/tests/test_common.py similarity index 98% rename from altair/vegalite/tests/test_common.py rename to tests/vegalite/tests/test_common.py index e423259e1..549177a83 100644 --- a/altair/vegalite/tests/test_common.py +++ b/tests/vegalite/tests/test_common.py @@ -4,7 +4,7 @@ import pandas as pd -from .. import v3, v4, v5 +from altair.vegalite import v3, v4, v5 @pytest.fixture diff --git a/tests/vegalite/v3/__init__.py b/tests/vegalite/v3/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/vegalite/v3/tests/__init__.py b/tests/vegalite/v3/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/altair/vegalite/v3/tests/test_api.py b/tests/vegalite/v3/tests/test_api.py similarity index 100% rename from altair/vegalite/v3/tests/test_api.py rename to tests/vegalite/v3/tests/test_api.py diff --git a/altair/vegalite/v5/tests/test_data.py b/tests/vegalite/v3/tests/test_data.py similarity index 95% rename from altair/vegalite/v5/tests/test_data.py rename to tests/vegalite/v3/tests/test_data.py index 8eae11c86..27a1f19d8 100644 --- a/altair/vegalite/v5/tests/test_data.py +++ b/tests/vegalite/v3/tests/test_data.py @@ -3,7 +3,7 @@ import pandas as pd import pytest -from .. import data as alt +from altair.vegalite.v3 import data as alt @pytest.fixture diff --git a/altair/vegalite/v3/tests/test_display.py b/tests/vegalite/v3/tests/test_display.py similarity index 100% rename from altair/vegalite/v3/tests/test_display.py rename to tests/vegalite/v3/tests/test_display.py diff --git a/altair/vegalite/v3/tests/test_geo_interface.py b/tests/vegalite/v3/tests/test_geo_interface.py similarity index 100% rename from altair/vegalite/v3/tests/test_geo_interface.py rename to tests/vegalite/v3/tests/test_geo_interface.py diff --git a/altair/vegalite/v3/tests/test_renderers.py b/tests/vegalite/v3/tests/test_renderers.py similarity index 100% rename from altair/vegalite/v3/tests/test_renderers.py rename to tests/vegalite/v3/tests/test_renderers.py diff --git a/altair/vegalite/v3/tests/test_theme.py b/tests/vegalite/v3/tests/test_theme.py similarity index 100% rename from altair/vegalite/v3/tests/test_theme.py rename to tests/vegalite/v3/tests/test_theme.py diff --git a/tests/vegalite/v4/__init__.py b/tests/vegalite/v4/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/vegalite/v4/tests/__init__.py b/tests/vegalite/v4/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/altair/vegalite/v4/tests/test_api.py b/tests/vegalite/v4/tests/test_api.py similarity index 100% rename from altair/vegalite/v4/tests/test_api.py rename to tests/vegalite/v4/tests/test_api.py diff --git a/altair/vegalite/v4/tests/test_data.py b/tests/vegalite/v4/tests/test_data.py similarity index 95% rename from altair/vegalite/v4/tests/test_data.py rename to tests/vegalite/v4/tests/test_data.py index 8eae11c86..72140be1e 100644 --- a/altair/vegalite/v4/tests/test_data.py +++ b/tests/vegalite/v4/tests/test_data.py @@ -3,7 +3,7 @@ import pandas as pd import pytest -from .. import data as alt +from altair.vegalite.v4 import data as alt @pytest.fixture diff --git a/altair/vegalite/v4/tests/test_display.py b/tests/vegalite/v4/tests/test_display.py similarity index 100% rename from altair/vegalite/v4/tests/test_display.py rename to tests/vegalite/v4/tests/test_display.py diff --git a/altair/vegalite/v4/tests/test_geo_interface.py b/tests/vegalite/v4/tests/test_geo_interface.py similarity index 100% rename from altair/vegalite/v4/tests/test_geo_interface.py rename to tests/vegalite/v4/tests/test_geo_interface.py diff --git a/altair/vegalite/v4/tests/test_renderers.py b/tests/vegalite/v4/tests/test_renderers.py similarity index 100% rename from altair/vegalite/v4/tests/test_renderers.py rename to tests/vegalite/v4/tests/test_renderers.py diff --git a/altair/vegalite/v4/tests/test_theme.py b/tests/vegalite/v4/tests/test_theme.py similarity index 100% rename from altair/vegalite/v4/tests/test_theme.py rename to tests/vegalite/v4/tests/test_theme.py diff --git a/tests/vegalite/v5/__init__.py b/tests/vegalite/v5/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/vegalite/v5/tests/__init__.py b/tests/vegalite/v5/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/altair/vegalite/v5/tests/test_api.py b/tests/vegalite/v5/tests/test_api.py similarity index 100% rename from altair/vegalite/v5/tests/test_api.py rename to tests/vegalite/v5/tests/test_api.py diff --git a/altair/vegalite/v3/tests/test_data.py b/tests/vegalite/v5/tests/test_data.py similarity index 95% rename from altair/vegalite/v3/tests/test_data.py rename to tests/vegalite/v5/tests/test_data.py index 8eae11c86..2cf48e833 100644 --- a/altair/vegalite/v3/tests/test_data.py +++ b/tests/vegalite/v5/tests/test_data.py @@ -3,7 +3,7 @@ import pandas as pd import pytest -from .. import data as alt +from altair.vegalite.v5 import data as alt @pytest.fixture diff --git a/altair/vegalite/v5/tests/test_display.py b/tests/vegalite/v5/tests/test_display.py similarity index 100% rename from altair/vegalite/v5/tests/test_display.py rename to tests/vegalite/v5/tests/test_display.py diff --git a/altair/vegalite/v5/tests/test_geo_interface.py b/tests/vegalite/v5/tests/test_geo_interface.py similarity index 100% rename from altair/vegalite/v5/tests/test_geo_interface.py rename to tests/vegalite/v5/tests/test_geo_interface.py diff --git a/altair/vegalite/v5/tests/test_renderers.py b/tests/vegalite/v5/tests/test_renderers.py similarity index 100% rename from altair/vegalite/v5/tests/test_renderers.py rename to tests/vegalite/v5/tests/test_renderers.py diff --git a/altair/vegalite/v5/tests/test_theme.py b/tests/vegalite/v5/tests/test_theme.py similarity index 100% rename from altair/vegalite/v5/tests/test_theme.py rename to tests/vegalite/v5/tests/test_theme.py