Skip to content

Commit

Permalink
CI: Fix uncaught RuntimeWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Feb 19, 2024
1 parent 7f6a356 commit c07f16b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 0 additions & 6 deletions plotnine/geoms/annotation_logticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -299,7 +297,3 @@ def __init__(
lengths=lengths,
base=base,
)


def is_continuous_scale(sc: scale) -> TypeGuard[ScaleContinuous]:
return isinstance(sc, ScaleContinuous)
5 changes: 4 additions & 1 deletion tests/test_aes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pandas as pd
import pytest

from plotnine import (
aes,
Expand Down Expand Up @@ -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)})
Expand Down
7 changes: 4 additions & 3 deletions tests/test_annotation_logticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def test_annotation_logticks():
panel_grid_major=element_line(color="red"),
)
)

assert p == "annotation_logticks"


Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion tests/test_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit c07f16b

Please sign in to comment.