Skip to content

Commit

Permalink
TST: FIX: Consider array length in artist arrays comparison (#2363)
Browse files Browse the repository at this point in the history
* Add artists length comparison

* Fix jointplot tests

* Fix displot tests

(cherry picked from commit 2717408)
  • Loading branch information
MaozGelbart authored and mwaskom committed Nov 25, 2020
1 parent 6cbd26f commit 28f9901
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions seaborn/_testing.py
Expand Up @@ -40,6 +40,7 @@

def assert_artists_equal(list1, list2, properties):

assert len(list1) == len(list2)
for a1, a2 in zip(list1, list2):
prop1 = a1.properties()
prop2 = a2.properties()
Expand Down
16 changes: 8 additions & 8 deletions seaborn/tests/test_axisgrid.py
Expand Up @@ -1515,8 +1515,8 @@ def test_scatter_hue(self, long_df):

g2 = ag.JointGrid()
scatterplot(data=long_df, x="x", y="y", hue="a", ax=g2.ax_joint)
histplot(data=long_df, x="x", hue="a", ax=g2.ax_marg_x)
histplot(data=long_df, y="y", hue="a", ax=g2.ax_marg_y)
kdeplot(data=long_df, x="x", hue="a", ax=g2.ax_marg_x, fill=True)
kdeplot(data=long_df, y="y", hue="a", ax=g2.ax_marg_y, fill=True)

assert_plots_equal(g1.ax_joint, g2.ax_joint)
assert_plots_equal(g1.ax_marg_x, g2.ax_marg_x, labels=False)
Expand Down Expand Up @@ -1571,9 +1571,9 @@ def test_kde(self, long_df):
g1 = ag.jointplot(data=long_df, x="x", y="y", kind="kde")

g2 = ag.JointGrid()
histplot(data=long_df, x="x", y="y", ax=g2.ax_joint)
histplot(data=long_df, x="x", ax=g2.ax_marg_x)
histplot(data=long_df, y="y", ax=g2.ax_marg_y)
kdeplot(data=long_df, x="x", y="y", ax=g2.ax_joint)
kdeplot(data=long_df, x="x", ax=g2.ax_marg_x)
kdeplot(data=long_df, y="y", ax=g2.ax_marg_y)

assert_plots_equal(g1.ax_joint, g2.ax_joint)
assert_plots_equal(g1.ax_marg_x, g2.ax_marg_x, labels=False)
Expand Down Expand Up @@ -1610,9 +1610,9 @@ def test_palette(self, long_df):
g1 = ag.jointplot(x="x", y="y", **kws)

g2 = ag.JointGrid()
kdeplot(x="x", y="y", ax=g2.ax_joint, **kws)
kdeplot(x="x", ax=g2.ax_marg_x, **kws)
kdeplot(y="y", ax=g2.ax_marg_y, **kws)
scatterplot(x="x", y="y", ax=g2.ax_joint, **kws)
kdeplot(x="x", ax=g2.ax_marg_x, fill=True, **kws)
kdeplot(y="y", ax=g2.ax_marg_y, fill=True, **kws)

assert_plots_equal(g1.ax_joint, g2.ax_joint)
assert_plots_equal(g1.ax_marg_x, g2.ax_marg_x, labels=False)
Expand Down
6 changes: 2 additions & 4 deletions seaborn/tests/test_distributions.py
Expand Up @@ -2039,15 +2039,13 @@ def test_with_rug(self, long_df, kwargs):

ax = rugplot(data=long_df, **kwargs)
g = displot(long_df, rug=True, **kwargs)
for bar in g.ax.patches:
bar.remove()
g.ax.patches = []

assert_plots_equal(ax, g.ax, labels=False)

long_df["_"] = "_"
g2 = displot(long_df, col="_", rug=True, **kwargs)
for bar in g2.ax.patches:
bar.remove()
g2.ax.patches = []

assert_plots_equal(ax, g2.ax, labels=False)

Expand Down

0 comments on commit 28f9901

Please sign in to comment.