Skip to content

Commit

Permalink
Try to catch another edge case in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Jun 16, 2022
1 parent b0d99fa commit b67437f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion seaborn/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def _compute_univariate_density(
"Pass `warn_singular=False` to disable this warning."
)
if warn_singular:
warnings.warn(msg, UserWarning)
warnings.warn(msg, UserWarning, stacklevel=4)
continue

if log_scale:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,10 @@ def test_singular_data(self):
ax = dist.kdeplot(x=[5], y=[6])
assert not ax.lines

with pytest.warns(UserWarning):
ax = kdeplot(x=[1929245168.06679] * 18, y=np.arange(18))
assert not ax.lines

with warnings.catch_warnings():
warnings.simplefilter("error", UserWarning)
ax = kdeplot(x=[5], y=[7], warn_singular=False)
Expand Down

0 comments on commit b67437f

Please sign in to comment.