Skip to content

Commit

Permalink
updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Aug 9, 2018
1 parent 884a853 commit a3dd65b
Show file tree
Hide file tree
Showing 34 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@ build
test_figures
.coverage
!corner/tests/baseline_images/*/*.png
.pytest_cache
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -18,7 +18,7 @@ install:
- conda update -q conda
- conda info -a

- conda create --yes -n test python=$PYTHON_VERSION matplotlib=$MATPLOTLIB_VERSION numpy scipy nose setuptools pandas
- conda create --yes -n test python=$PYTHON_VERSION matplotlib=$MATPLOTLIB_VERSION numpy scipy setuptools pandas pytest pytest-cov
- source activate test
- pip install coveralls

Expand All @@ -28,7 +28,7 @@ before_script: # configure a headless display to test plot generation
- sleep 3 # give xvfb some time to start

script:
- nosetests corner --with-coverage --cover-package=corner
- py.test -v --cov corner

after_success:
- coveralls
Binary file modified corner/tests/baseline_images/test_corner/basic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/color.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/color_filled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/labels.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/no_fill_contours.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/overplot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/pandas.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/quantiles.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/reverse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/smooth1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/smooth1d.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/smooth2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/tight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/titles1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/titles2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/top_ticks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_corner/truths.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/basic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/color.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/cutoff.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/cutoff2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/filled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/levels1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/levels2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/lowN.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified corner/tests/baseline_images/test_hist2d/lowNfilled.png
Binary file modified corner/tests/baseline_images/test_hist2d/lowNnofill.png
Binary file modified corner/tests/baseline_images/test_hist2d/philsplot.png
Binary file modified corner/tests/baseline_images/test_hist2d/smooth1.png
Binary file modified corner/tests/baseline_images/test_hist2d/smooth2.png
21 changes: 21 additions & 0 deletions corner/tests/test_corner.py
Expand Up @@ -32,68 +32,89 @@ def _run_corner(pandas=False, N=10000, seed=1234, ndim=3, factor=None,
def test_basic():
_run_corner()


@image_comparison(baseline_images=["labels"], extensions=["png"])
def test_labels():
_run_corner(labels=["a", "b", "c"])


@image_comparison(baseline_images=["quantiles"], extensions=["png"])
def test_quantiles():
_run_corner(quantiles=[0.16, 0.5, 0.84])


@image_comparison(baseline_images=["color"], extensions=["png"])
def test_color():
_run_corner(color="g")


@image_comparison(baseline_images=["color_filled"], extensions=["png"])
def test_color_filled():
_run_corner(color="g", fill_contours=True)


@image_comparison(baseline_images=["overplot"], extensions=["png"])
def test_overplot():
fig = _run_corner(color="g", fill_contours=True)
_run_corner(seed=15, color="b", fig=fig, fill_contours=True)


@image_comparison(baseline_images=["smooth1"], extensions=["png"])
def test_smooth1():
_run_corner(bins=50)


@image_comparison(baseline_images=["smooth2"], extensions=["png"])
def test_smooth2():
_run_corner(bins=50, smooth=1.0)


@image_comparison(baseline_images=["smooth1d"], extensions=["png"])
def test_smooth1d():
_run_corner(bins=50, smooth=1.0, smooth1d=1.0)


@image_comparison(baseline_images=["titles1"], extensions=["png"])
def test_titles1():
_run_corner(show_titles=True)


@image_comparison(baseline_images=["titles2"], extensions=["png"])
def test_titles2():
_run_corner(show_titles=True, title_fmt=None, labels=["a", "b", "c"])


@image_comparison(baseline_images=["top_ticks"], extensions=["png"])
def test_top_ticks():
_run_corner(top_ticks=True)


@image_comparison(baseline_images=["pandas"], extensions=["png"])
def test_pandas():
_run_corner(pandas=True)


@image_comparison(baseline_images=["truths"], extensions=["png"])
def test_truths():
_run_corner(truths=[0.0, None, 0.15])


@image_comparison(baseline_images=["no_fill_contours"], extensions=["png"])
def test_no_fill_contours():
_run_corner(no_fill_contours=True)


@image_comparison(baseline_images=["tight"], extensions=["png"])
def test_tight():
_run_corner(ret=True)
pl.tight_layout()


@image_comparison(baseline_images=["reverse"], extensions=["png"])
def test_reverse():
_run_corner(ndim=2, range=[(4, -4), (-5, 5)])


@image_comparison(baseline_images=["hist_bin_factor"], extensions=["png"])
def test_hist_bin_factor():
_run_corner(hist_bin_factor=4)
12 changes: 12 additions & 0 deletions corner/tests/test_hist2d.py
Expand Up @@ -23,52 +23,64 @@ def _run_hist2d(nm, N=50000, seed=1234, **kwargs):
def test_cutoff():
_run_hist2d("cutoff", range=[(0, 4), (0, 2.5)])


@image_comparison(baseline_images=["cutoff2"], extensions=["png"])
def test_cutoff2():
_run_hist2d("cutoff2", range=[(-4, 4), (-0.1, 0.1)], N=100000,
fill_contours=True, smooth=1)


@image_comparison(baseline_images=["basic"], extensions=["png"])
def test_basic():
_run_hist2d("basic")


@image_comparison(baseline_images=["color"], extensions=["png"])
def test_color():
_run_hist2d("color", color="g")


@image_comparison(baseline_images=["levels1"], extensions=["png"])
def test_levels1():
_run_hist2d("levels1", levels=[0.68, 0.95])


@image_comparison(baseline_images=["levels2"], extensions=["png"])
def test_levels2():
_run_hist2d("levels2", levels=[0.5, 0.75])


@image_comparison(baseline_images=["filled"], extensions=["png"])
def test_filled():
_run_hist2d("filled", fill_contours=True)


@image_comparison(baseline_images=["smooth1"], extensions=["png"])
def test_smooth1():
_run_hist2d("smooth1", bins=50)


@image_comparison(baseline_images=["smooth2"], extensions=["png"])
def test_smooth2():
_run_hist2d("smooth2", bins=50, smooth=(1.0, 1.5))


@image_comparison(baseline_images=["philsplot"], extensions=["png"])
def test_philsplot():
_run_hist2d("philsplot", plot_datapoints=False, fill_contours=True,
levels=[0.68, 0.95], color="g", bins=50, smooth=1.)


@image_comparison(baseline_images=["lowN"], extensions=["png"])
def test_lowN():
_run_hist2d("lowN", N=20)


@image_comparison(baseline_images=["lowNfilled"], extensions=["png"])
def test_lowNfilled():
_run_hist2d("lowNfilled", N=20, fill_contours=True)


@image_comparison(baseline_images=["lowNnofill"], extensions=["png"])
def test_lowNnofill():
_run_hist2d("lowNnofill", N=20, no_fill_contours=True)

0 comments on commit a3dd65b

Please sign in to comment.