Skip to content

Commit

Permalink
clean up warnings import setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashergt committed Oct 19, 2023
1 parent 7e18ecb commit 4fd8726
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_plot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import warnings

import anesthetic.examples._matplotlib_agg # noqa: F401
from packaging import version
from warnings import catch_warnings
from warnings import catch_warnings, filterwarnings
import pytest
import numpy as np
import matplotlib
Expand Down Expand Up @@ -767,8 +765,8 @@ def test_make_axes_logscale():
assert ax.get_xscale() == 'log'
assert ax.get_yscale() == 'linear'
with catch_warnings():
warnings.filterwarnings('error', category=UserWarning,
message="Attempt to set non-positive")
filterwarnings('error', category=UserWarning,
message="Attempt to set non-positive")
ax.set_ylim(-1, 1)

# 2d, logy only
Expand All @@ -778,8 +776,8 @@ def test_make_axes_logscale():
for x, ax in rows.items():
assert ax.get_xscale() == 'linear'
with catch_warnings():
warnings.filterwarnings('error', category=UserWarning,
message="Attempt to set non-positive")
filterwarnings('error', category=UserWarning,
message="Attempt to set non-positive")
ax.set_xlim(-1, 1)
if y in ['x0', 'x2']:
assert ax.get_yscale() == 'linear'
Expand Down

0 comments on commit 4fd8726

Please sign in to comment.