Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add test_semilogx and test_semilogy tests to test_datetime #27320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
Loading
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions 30 lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,17 +448,35 @@ def test_scatter(self):
label.set_rotation(40)
label.set_horizontalalignment('right')

@pytest.mark.xfail(reason="Test for semilogx not written yet")
@mpl.style.context("default")
def test_semilogx(self):
fig, ax = plt.subplots()
ax.semilogx(...)
mpl.rcParams["date.converter"] = "concise"
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True)

base = datetime.datetime(2000, 1, 1)
log_dates = [base + datetime.timedelta(days=((2 ** i) * 365)) for i in range(5)]
reg_dates = [base + datetime.timedelta(days=(i)) for i in range(5)]
log_vals = [2 ** i for i in range(5)]
reg_vals = [i for i in range(5)]

ax1.semilogx(log_dates, reg_dates, base = 2)
ax2.semilogx(log_dates, reg_vals, base = 2)
ax3.semilogx(log_vals, reg_dates, base = 2)

@pytest.mark.xfail(reason="Test for semilogy not written yet")
@mpl.style.context("default")
def test_semilogy(self):
fig, ax = plt.subplots()
ax.semilogy(...)
mpl.rcParams["date.converter"] = "concise"
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True)

base = datetime.datetime(2000, 1, 1)
log_dates = [base + datetime.timedelta(days=((2 ** i) * 365)) for i in range(5)]
reg_dates = [base + datetime.timedelta(days=(i)) for i in range(5)]
log_vals = [2 ** i for i in range(5)]
reg_vals = [i for i in range(5)]

ax1.semilogy(reg_dates, log_dates, base = 2)
ax2.semilogy(reg_dates, log_vals, base = 2)
ax3.semilogy(reg_vals, log_dates, base = 2)

@pytest.mark.xfail(reason="Test for spy not written yet")
@mpl.style.context("default")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.