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

Attempted to add test_pcolorfast in test_datetime.py #27450

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 5 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
22 changes: 20 additions & 2 deletions 22 lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.dates as dt


class TestDatetimePlotting:
Expand Down Expand Up @@ -545,11 +546,28 @@ def test_pcolor(self):
fig, ax = plt.subplots()
ax.pcolor(...)

@pytest.mark.xfail(reason="Test for pcolorfast not written yet")
@mpl.style.context("default")
def test_pcolorfast(self):
np.random.seed(19680801)

'''
Directly inputting either datetime.datetime or numpy.datetime64
without using date2num() seems to always generate compile errors for pcolorfast().
I have used date2num() to ensure that the graph prints correctly
despite that such operations may defy the purpose of conducting such tests.
'''
basedate_x = datetime.datetime(2023, 12, 6, 1, 30, 30)
basedate_y = datetime.datetime(2024, 5, 5, 12, 15, 45)
dates_x = [dt.date2num(basedate_x + datetime.timedelta(days=1*i, hours=6*i, minutes=20*i)) for i in range(10)]
dates_y = [dt.date2num(basedate_y + datetime.timedelta(days=1*i, hours=8*i, minutes=30*i)) for i in range(10)]
data = np.random.rand(0, 100)

fig, ax = plt.subplots()
ax.pcolorfast(...)
pc = ax.pcolorfast(dates_x, dates_y, data)

ax.set_xlabel('Sample datetime')
ax.set_ylabel('Sample data')
ax.set_title('Sample test case for pcolorfast()')

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