diff --git a/plotnine/geoms/annotation_logticks.py b/plotnine/geoms/annotation_logticks.py index 5fae9bc11..49aa29627 100644 --- a/plotnine/geoms/annotation_logticks.py +++ b/plotnine/geoms/annotation_logticks.py @@ -19,13 +19,11 @@ from matplotlib.axes import Axes from mizani.transforms import trans - from typing_extensions import TypeGuard from plotnine.coords.coord import coord from plotnine.facets.layout import Layout from plotnine.geoms.geom import geom from plotnine.iapi import panel_view - from plotnine.scales.scale import scale from plotnine.typing import ( AnyArray, TupleFloat2, @@ -299,7 +297,3 @@ def __init__( lengths=lengths, base=base, ) - - -def is_continuous_scale(sc: scale) -> TypeGuard[ScaleContinuous]: - return isinstance(sc, ScaleContinuous) diff --git a/tests/test_aes.py b/tests/test_aes.py index ceae98b96..514709704 100644 --- a/tests/test_aes.py +++ b/tests/test_aes.py @@ -1,5 +1,6 @@ import numpy as np import pandas as pd +import pytest from plotnine import ( aes, @@ -71,7 +72,9 @@ def test_stat_ecdf(self): + stat_ecdf() + scale_y_log10() ) - assert p == "stat_ecdf" + + with pytest.warns(RuntimeWarning): + assert p == "stat_ecdf" def test_stat_bin_2d(self): data = pd.DataFrame({"x": [1, 10, 100, 1000], "y": range(4)}) diff --git a/tests/test_annotation_logticks.py b/tests/test_annotation_logticks.py index d024cac81..632ea8977 100644 --- a/tests/test_annotation_logticks.py +++ b/tests/test_annotation_logticks.py @@ -34,7 +34,6 @@ def test_annotation_logticks(): panel_grid_major=element_line(color="red"), ) ) - assert p == "annotation_logticks" @@ -172,8 +171,10 @@ def test_wrong_bases(): + geom_point() ) - with pytest.warns(PlotnineWarning): + with pytest.warns() as rec: p.draw_test() + rec.pop(PlotnineWarning) + rec.pop(RuntimeWarning) # x axis not transform, but ticks requested for a different base p = ( @@ -205,7 +206,7 @@ def test_wrong_bases(): + geom_point() ) - with pytest.warns(PlotnineWarning): + with pytest.warns() as rec: p.draw_test() # x axis is discrete + coord flip. diff --git a/tests/test_position.py b/tests/test_position.py index 8c6ded1be..6972de9f9 100644 --- a/tests/test_position.py +++ b/tests/test_position.py @@ -115,7 +115,10 @@ def test_stack_non_linear_scale(): + geom_col() + scale_y_log10() ) - assert p == "stack-non-linear-scale" + + with pytest.warns(RuntimeWarning) as rec: + assert p == "stack-non-linear-scale" + assert len(rec) == 1 def test_fill():